Re: [twsocket] Freeze when using smtp after recreating its parentform
Hello Henrik, this is frustrating :( When the trace dissapears it could also be an AV (unles you have 'stop on exceptions' enabled in the IDE). Can you send me the offending project in private mail, including source and the compiled exe file ? I can do a test on several computers if you want. Please include in your mail the steps nececary to reproduce the problem. Alternative as second step I could make a mini project (with TWSocket just connecting to someone or something) that you can test, but let's try first step 1. --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Freeze when using smtp after recreating its parentform
XSocketWindowProc Start WSocket.pas: function XSocketWindowProc End WSocket.pas: function XSocketWindowProc Start WSocket.pas: function XSocketWindowProc End WSocket.pas: function XSocketWindowProc I close the SmtpTestForm, release it and create it again. When ConnectButton is pressed this time I get the following trace: -- Start WSocket.pas: function XSocketWindowProc End WSocket.pas: function XSocketWindowProc Start WSocket.pas: function XSocketWindowProc End WSocket.pas: function XSocketWindowProc Start WSocket.pas: function XSocketWindowProc End WSocket.pas: function XSocketWindowProc Start WSocket.pas: function XSocketWindowProc End WSocket.pas: function XSocketWindowProc Start WSocket.pas: function XSocketWindowProc End WSocket.pas: function XSocketWindowProc Start WSocket.pas: function XSocketWindowProc Start WSocket.pas: procedure TCustomWSocket.WndProc Start WSocket.pas: procedure TCustomWSocket.WMAsyncGetHostByName Start WSocket.pas: procedure TCustomWSocket.TriggerDNSLookupDone Start SmtpProt.pas: procedure TCustomSmtpClient.WSocketDnsLookupDone Start WSocket.pas: procedure TCustomSocksWSocket.Connect Start WSocket.pas: procedure TCustomWSocket.Connect Start WSocket.pas: function WSocket_Synchronized_WSAAsyncSelect Hang on the line below this row: Result := FWSAAsyncSelect... -Ursprungligt meddelande- Från: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] För Wilfried Mestdagh Skickat: den 12 december 2006 13:17 Till: ICS support mailing Ämne: Re: [twsocket] Freeze when using smtp after recreating its parentform Hello Henrik, Do you have the same problem in the IDE ? Because this way you can check witch code line never comes back (freeze). If not eventually open a console window and write some debug information into it to see where it happens. Your approach is normal. I do this all the time, however I almost never use forms for it. Normally I have an object containing the component, eg TSmtpClient, another object that creates / handles / destroy the TSmtpClient objects. But in principle it is the same. It can as whell be a DataModule, a Form or whatever other object. Question: We do understeand the word 'Freeze' the right way ? Form cannot moved, closed, application cannot quit, etc... Right ? --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Freeze when using smtp after recreating its parentform
> > Question: We do understeand the word 'Freeze' the right way ? Form > cannot moved, closed, application cannot quit, etc... Right ? > It was writen in some previous posting that the application was then at 50% cpu, so on a hyperthreaded cpu, the application is in some fast loop, i gues -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Freeze when using smtp after recreating its parentform
Hi again Frans! > Sorry, for not expressing myself any better. No need for excuse, it was probably I who misunderstood You... > My question was "If you run the debug and while > entring the buttonclick is the .release finished > so did you find the form to be free-ed already" Yes, I think so. (The freezing occurs when trying to connect the second time the SmtpTestForm is created) > and my second remark was "If you replace the .release > with .free is the problem still there?". Yes, it's still there (and also if using Action := caFree in OnClose) > My final remark was that I normally have the form > as a procedure variable as it is not needed to be > defined outside the buttonclick event and maybe that > also solves your issue. I don't know if I understand You correctly but I think I'm doing the same; I have a separate email unit in my code library with a single Execute function that takes the necessary e-mail settings as parameters (host, emailaddress and so on), shows a status form and returns true or false depending on if the email was sent or not. This function takes care of everything for me so I can use it to send email from any application just using the Execute function. Best Regards Henrik -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Freeze when using smtp after recreating its parentform
Hi Arno and thank You for the reply! I use V2.32 of SmtpProt.pas (the one You get when clicking "Download the latest ICS-V5 Distribution" on overbyte.be) and Delphi7. Trying to solve this mystery I have now discovered two things: * Since You did not experience any problem I decided to test the example application on another computer by copying the exe-file. Here the second time I show the SmtpTestForm and presses the "All-in-one" button everything works ok and the mail is being sent as expected!!! Do You have any ideas on what can be the difference between these computers that leads to the freeze problem on just one of them? (both has Win XP SP2 and the latest Windows update patches) * I don't know if this gives any clues but a workaround on the computer where the problems appear is to either not destroy the form OR create a dummy smtpCli component like in the code below! procedure TForm2.Button1Click(Sender: TObject); var dummySmtpCli : TSmtpCli; alreadyCreated: Boolean; i: integer; begin SmtpTestForm := TSmtpTestForm.Create(Application); // Workaround that prevents freezing on some computers alreadyCreated := false; if Application.ComponentCount > 0 then begin for i := 0 to Application.ComponentCount-1 do begin if Application.Components[i].Name = 'DummySmtpClient' then begin alreadyCreated := true; BREAK; end; end; end; if not(alreadyCreated) then begin dummySmtpCli := TSmtpCli.Create(Application); dummySmtpCli.Name := 'DummySmtpClient'; end; try SmtpTestForm.ShowModal; finally SmtpTestForm.Release; end; end; Any further thoughts on the matter is greatly appreciated! // Henrik -Ursprungligt meddelande- Från: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] För Arno Garrels Skickat: den 11 december 2006 10:32 Till: ICS support mailing Ämne: Re: [twsocket] Freeze when using smtp after recreating its parentform Hello Henrik, Just tested with latest V5 beta, but works great? --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Henrik wrote: > Hi! > > I have probably misunderstood something because I get the same > behavior described below no matter which of the components SmtpCli, > SyncSmtpCli and HtmlSmtpCli I use. > > The problem has to do with freeing the smtp-components parent form. > You can easily duplicate the behavior with one of the standard demo > applications: * Open Your favorite demo of MailSnd, MimeTst or > MailHtml. (I proceed with MailSnd-demo below.) > * Add a new form with a button to the project. Write the following in > the buttons OnClick method: > procedure TForm2.Button1Click(Sender: TObject); > begin > SmtpTestForm := TSmtpTestForm.Create(Application); > try > SmtpTestForm.ShowModal; > finally > SmtpTestForm.Release; > end; > end; > * Click on the menu: "Project" - "Options", and remove the > SmtpTestFrom from the "Auto-createForms" list. > * Run the application and click the button. SmtpTestForm opens and You > can send lots of e-mails. > * Close SmtpTestForm and press the button again. Try to send yet > another email and You get stuck! > > I guess I'm doing something fundamentally wrong?! I have narrowed it > down to that everything works as expected if I don't release the form. > (I get the same error when setting Action to caFree in > SmtpTestFrom.OnClose.) > > Is it not a good idea to free a manually created form? > > Best Regards > Henrik -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Freeze when using smtp after recreating its parentform
Hi Frans! Yes, each time You press the button the form is created and then released. You also get the same problem if You set Action to caFree in the OnClose of the created form. procedure TForm2.Button1Click(Sender: TObject); begin SmtpTestForm := TSmtpTestForm.Create(Application); SmtpTestForm.ShowModal; end; procedure TSmtpTestForm.FormClose(Sender: TObject; var Action: TCloseAction); begin Action := caFree; end; Also read my response to Arno. I'm very thankful for all the help I can get! // Henrik -Ursprungligt meddelande- Från: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] För Frans van Daalen Skickat: den 11 december 2006 10:39 Till: ICS support mailing Ämne: Re: [twsocket] Freeze when using smtp after recreating its parentform - Original Message - From: "Henrik" <[EMAIL PROTECTED]> To: Sent: Monday, December 11, 2006 9:59 AM Subject: [twsocket] Freeze when using smtp after recreating its parent form > Hi! > > I have probably misunderstood something because I get the same behavior > described below no matter which of the components SmtpCli, SyncSmtpCli and > HtmlSmtpCli I use. > > The problem has to do with freeing the smtp-components parent form. You > can > easily duplicate the behavior with one of the standard demo applications: > * Open Your favorite demo of MailSnd, MimeTst or MailHtml. (I proceed > with > MailSnd-demo below.) > * Add a new form with a button to the project. Write the following in the > buttons OnClick method: > procedure TForm2.Button1Click(Sender: TObject); > begin > SmtpTestForm := TSmtpTestForm.Create(Application); > try > SmtpTestForm.ShowModal; > finally > SmtpTestForm.Release; > end; > end; When entering the second time is the form already released then? I normally just call .free never used .released. I also make the SmtpTestForm a procedure based variable in these kind of constructions. -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Freeze when using smtp after recreating its parentform
> I normally just call .free never used .released. You have to use Release when called from an event handler which originate from the form you are freeing. Release make sure all curent events are processed. Free does an immediate free which will crash the application if one event handler is still running. Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be