FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Release bitmaps in xbrowse
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Release bitmaps in xbrowse
Posted: Wed Feb 19, 2014 11:39 AM
Hello,

I have a xbrowse with 128 columns, and for each column I add 11 bmp's from resource.
That is working file, but if I open and close the browse 20 times, the program quit.
If a leave te BMP's out, I dont have a problem.
How can I free them from memory?

Code (fw): Select all Collapse
vGetlist := TXBrowse():New( oDlg )
FOR i = 1 to 128
    oCol := vGetlist:AddCol()
    oCol:bStrData      := &('{ || tmp->naam'+padl(i,2,'0')+'}')
    oCol:cHeader       := 'N'+str(i)
    oCol:nWidth        := 60
    oCol:lAllowSizing  := .f.
    oCol:AddResource("C_BOVEN")
    oCol:AddResource("C_BOVENE")
    oCol:AddResource("C_MIDDEN")
    oCol:AddResource("C_ONDER")
    oCol:AddResource("C_ENKEL")
    oCol:AddResource("C_ENKELE")
    oCol:AddResource("C_BOVENP") 
    oCol:AddResource("C_BOVENX") 
    oCol:AddResource("C_ENKELP")
    oCol:AddResource("C_ENKELX")
    oCol:AddResource("C_GEEN")
 NEXT i


I already try with oCol:=nil and vGetlist:=nil, without result
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Release bitmaps in xbrowse
Posted: Wed Feb 19, 2014 03:30 PM

Mark,

I checked and the class TxBrwColumn's End() method is deleting all the bitmaps. For some reason the TXBrowse class does not have an End() method but it does have a Destroy() method so try calling oBrw:destroy() when closing the browse. I do see that this method is destroying all bitmaps in the aBitmaps array. This may help, however, I don't see that all the column objects are being destroyed (ended). I must be missing something--perhaps Nages can explain.

Nages, also, to be consistent it seems that there should be an TXBrowse:End() method (even if it just calls the Destroy() method).

I am using FWH 13.04 with xHarbour. Maybe newer versions are different.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Release bitmaps in xbrowse
Posted: Wed Feb 19, 2014 08:50 PM
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Release bitmaps in xbrowse
Posted: Thu Feb 20, 2014 02:02 AM

Marc,

Ah, yes, that is already in my version. Glad you found a solution. You should still consider upgrading to the current version since there have been so many fixes and enhancements.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Release bitmaps in xbrowse
Posted: Thu Feb 20, 2014 02:05 AM
Nages,

Please disregard my previous comment:

Nages, also, to be consistent it seems that there should be an TXBrowse:End() method (even if it just calls the Destroy() method).


It came to me that the container object (window or dialog) is calling the destroy() method so there is no need for us to do this in our code.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion