I think the destructor of TIcsWndHandler should be responsible for freeing 
it.  Its labelled FOwnerList, and the F usually means its private, so other 
classes shouldnt have to manually free it.

Dan

----- Original Message ----- 
From: "Éric Fleming Bonilha" <[EMAIL PROTECTED]>
To: <twsocket@elists.org>
Sent: Tuesday, April 25, 2006 9:06 PM
Subject: [twsocket] ICS 6 Bug - Memory Leak


I´m using FastMM4, by declaring FastMM4 as first unit of my project, and 
when I close my application it says that there is 1 memory leak on module 
TIcsWndHandlerList.

This bug occurs even on the demo applications provided on ICS package

I have read the code of unit OverbyteIcsWndControl and I found a possible 
bug on the procedure TIcsWndHandlerPool.FreeWndHandler

procedure TIcsWndHandlerPool.FreeWndHandler(var WndHandler: TIcsWndHandler);
var
    Index : Integer;
begin
    if not Assigned(WndHandler.FOwnerList) then
        Exit;
    Index := WndHandler.FOwnerList.IndexOf(WndHandler);
    if Index >= 0 then begin
        WndHandler.FOwnerList.Delete(Index);
        if WndHandler.FOwnerList.Count <= 0 then begin
            Index := FList.IndexOf(WndHandler.FOwnerList);
            if Index >= 0 then
                FList.Delete(Index);
        end;
        WndHandler.Free;
        WndHandler := nil;
    end;
end;

The problem is that this routine is not freeing the WndHandle.FOwnerList

I added the code:

        WndHandle.FOwnerList.Free;
        WndHandler.Free;
        WndHandler := nil;
    end;
end;

just for test, and it worked fine, the memory leak message didn´t appears 
anymore, but I don´t know the impact of this code on the rest of the package 
because I don´t know the internal funcionality of ICS.

The FOwnerList shouldn´t be freed when the WndHandle class is destroyed????

Éric
-- 
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

Reply via email to