GDI objects leaks
Posted: Wed Jan 23, 2008 4:05 pm
Hola Antonio,
I have found some bugs that cause GDI objects leaks.
TTreeVie.prg:
TVSetColor increment by two the GDI objects (two brushes) in use without decrement when destroy the TreeView. If you don't use custom color for the treeview you can don't call TVSetColor so I've change in:
If you use a ImageList with the TreeView it's not destroyed when you destroy the TreeView so I've add the method Destroy:
BtnBmp.prg
In the method LoadBitmaps there's no call to FreeBitmaps, so if you change the bitmaps at run-time it will open the new bitmaps without closing the others.
xBrowse.prg
Sometimes the method End isn't called when you close the dialog. I add a inline method destroy:
In the End method of TXBrwColumn class there is the DeleteObject of the bitmaps you used. But there isn't the DeleteObject of the bitmap's palette.
In the SetArray method if you use lAutoOrder two bitmaps (created by FwBmpAsc() and FwBmpDes()) are added to each column. It is not necessary, you can create the two bitmap handles when create the xBrowse and use the same for each column or create when your application start and use the same for each column of each xbrowse.
Thanks
Patrizio
I have found some bugs that cause GDI objects leaks.
TTreeVie.prg:
Code: Select all
METHOD SetColor( nClrText, nClrPane ) INLINE ;
Super:SetColor( nClrText, nClrPane ), TVSetColor( ::hWnd, nClrText, nClrPane )
Code: Select all
METHOD SetColor( nClrText, nClrPane ) CLASS TTreeView
Super:SetColor( nClrText, nClrPane )
IF !Empty(::hWnd) .AND. ( nClrText != ::oWnd:nClrText .OR. nClrPane != GetSysColor(COLOR_WINDOW) )
TVSetColor( ::hWnd, nClrText, nClrPane )
ENDIF
RETURN NIL
Code: Select all
METHOD Destroy() CLASS TTreeView
IF !Empty(::oImageList)
::oImageList:End()
ENDIF
RETURN Super:Destroy()
In the method LoadBitmaps there's no call to FreeBitmaps, so if you change the bitmaps at run-time it will open the new bitmaps without closing the others.
xBrowse.prg
Sometimes the method End isn't called when you close the dialog. I add a inline method destroy:
Code: Select all
METHOD Destroy() INLINE ::End()
Code: Select all
DeleteObject( ::aBitmaps[ nFor, BITMAP_PALETTE ] )
Thanks
Patrizio