>    The full error is "[EAccessViolation] Access
> violation at address 00469094 in module
> 'SmailQ_con.exe'. Read of address 00000008"
>     { vvvv THE FOLLOWING LINE vvvv }
>     if FBufList.Count = 0 then begin

It is likely that FBufList is already freed and nilled when the line is
executed. I'm almost sure Count member is at offset 8 in the class instance.

For some reason, you call PutDataInSendBuffer after it has already been
freed.
--
[EMAIL PROTECTED]
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be



----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <twsocket@elists.org>
Sent: Wednesday, December 05, 2007 10:24 PM
Subject: [twsocket] AV in TWSocketThrdServer.PutDataInSendBuffer


> Hello:
>     I was testing my application and and noticed in
> the log that when I tried to destroy the
> TWSocketThrdServer while it had opened connections, I
> got a few (seemingly) random AVs which I traced to
> the following lines in PutDataInSendBuffer method:
>
> procedure TCustomWSocket.PutDataInSendBuffer(Data :
> Pointer; Len : Integer);
> var
>   oBuffer  : TBuffer;
>   cWritten : Integer;
>   bMore  : Boolean;
> begin
>   if (Len <= 0) or (Data = nil) then
>     exit;
>
> {$IFDEF COMPILER2_UP}
>   EnterCriticalSection(GSendBufCritSect);
>   try
> {$ENDIF}
>     { vvvv THE FOLLOWING LINE vvvv }
>     if FBufList.Count = 0 then begin
>       oBuffer := TBuffer.Create(FBufSize);
>       FBufList.Add(oBuffer);
>     end
>     else
>       oBuffer := FBufList.Last;
>     Inc(FBufferedByteCount, Len);
>     bMore := TRUE;
>     while bMore do begin
>       cWritten := oBuffer.Write(Data, Len);
>       if cWritten >= Len then
>         bMore := FALSE
>       else begin
>         Len  := Len - cWritten;
>         Data := PChar(Data) + cWritten;
>         if Len < 0 then
>           bMore := FALSE
>         else begin
>           oBuffer := TBuffer.Create(FBufSize);
>           FBufList.Add(oBuffer);
>         end;
>       end;
>     end;
>     bAllSent := FALSE;
> {$IFDEF COMPILER2_UP}
>   finally
>     LeaveCriticalSection(GSendBufCritSect);
>   end;
> {$ENDIF}
> end;
>
>
>    The full error is "[EAccessViolation] Access
> violation at address 00469094 in module
> 'SmailQ_con.exe'. Read of address 00000008"
>
>    Its hard for me to reproduce exactly, but has
> anybody any idea what could be causing this?
>
>    -dZ.
>
> -- 
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to