Release bitmaps in xbrowse

Release bitmaps in xbrowse

Postby Marc Vanzegbroeck » 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: Select all  Expand view
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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Release bitmaps in xbrowse

Postby James Bott » Wed Feb 19, 2014 3: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Release bitmaps in xbrowse

Postby Marc Vanzegbroeck » Wed Feb 19, 2014 8:50 pm

Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Release bitmaps in xbrowse

Postby James Bott » Thu Feb 20, 2014 2: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Release bitmaps in xbrowse

Postby James Bott » Thu Feb 20, 2014 2: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 41 guests