Newsgroups : Borland : borland.public.delphi.internet.winsock : 2005 May : Access Violation on TidHttpServer and D5

www.cryer.info
Managed Newsgroup Archive

Access Violation on TidHttpServer and D5

Subject:Access Violation on TidHttpServer and D5
Posted by:"Matheus Degiovani" (mathe..@tilt.net)
Date:Tue, 3 May 2005 09:29:03

Hello,

I've recently installed Indy version 10.0.76 from the Atozed website
into Delphi 5, however I'm running into a problem with TidHttpServer. If
I write a simple application with 2 buttons, one to activate
(server.active:= true) and one to deactive (server.active:= false) the
server, whenever I hit the activate button, and then the deactivate
button I get an Access Violation.

I was able to trace the problem to the
TIdSchedulerOfThread.TerminateYarn method, on line 258:

begin
   LYarn := TIdYarnOfThread(AYarn);
   if LYarn.Thread.Suspended then begin
     // If suspended, was created but never started
     // ie waiting on connection accept
     LYarn.Thread.Free;
     FreeAndNil(LYarn);  // <======= Exception thrown here
...

Apparently, when the LYarn.thread.free is called, the destructor of
TIdYarnOfThread is exectued (I'm guessing the thread property has a code
to free its parent), however when freeAndNil(LYarn) is called, since
LYarn is already undefined an exception is raised.

I guess I could just comment one of these lines to solve the problem,
but I think that will generate a memory leak on the server.

Has anyone also had this problem?

Cya.

Replies:

www.cryer.info
Managed Newsgroup Archive