XBrowse metodo ChangeBitmap() pierde recursos

Post Reply
User avatar
manuelcalerosolis
Posts: 149
Joined: Mon Oct 10, 2005 9:30 am
Location: Huelva - Spain

XBrowse metodo ChangeBitmap() pierde recursos

Post by manuelcalerosolis »

Analizando la perdida de recursos en mi app, chkres me dice q en este método deja bitmaps por liberar.

Si comento el código de llamada a ese método la perdida de recursos desaparece.

Os dejo aki el código del método q menciono, por si alguien puede ver de manera rápida, q es lo q pasa.

//------------------------------------------------------------------------------

METHOD ChangeBitmap( ) CLASS TXBrwColumn // BtnGet

if ::nBtnBmp > 0 .and. len( ::aBitmaps ) >= ::nBtnBmp
::oBtnElip:hBitmap1 := ::aBitMaps[::nBtnBmp, BITMAP_HANDLE ]
::oBtnList:hBitmap1 := ::aBitMaps[::nBtnBmp, BITMAP_HANDLE ]
::oBtnElip:cCaption := ""
else
::oBtnElip:hBitmap1 := 0
::oBtnList:hBitmap1 := 0
::oBtnElip:cCaption := "..."
endif

::oBrw:refresh()

return nil

//----------------------------------------------------------------------------//

Saludos.
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: XBrowse metodo ChangeBitmap() pierde recursos

Post by nageswaragunupudi »

Thanks for pointing out the problem.

Please modify the function like this:

Code: Select all

 METHOD ChangeBitmap( ) CLASS TXBrwColumn // BtnGet

  if ::nBtnBmp > 0 .and. len( ::aBitmaps ) >= ::nBtnBmp
      DeleteObject( ::oBtnList:hBitmap1 )   // ---------------------------- NEW
      ::oBtnElip:hBitmap1 := ::aBitMaps[::nBtnBmp, BITMAP_HANDLE ]
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
manuelcalerosolis
Posts: 149
Joined: Mon Oct 10, 2005 9:30 am
Location: Huelva - Spain

Re: XBrowse metodo ChangeBitmap() pierde recursos

Post by manuelcalerosolis »

Creo q deberia de quedar asi no?


METHOD ChangeBitmap( ) CLASS TXBrwColumn // BtnGet

if ::nBtnBmp > 0 .and. len( ::aBitmaps ) >= ::nBtnBmp
DeleteObject( ::oBtnElip:hBitmap1 )
::oBtnElip:hBitmap1 := ::aBitMaps[::nBtnBmp, BITMAP_HANDLE ]
DeleteObject( ::oBtnList:hBitmap1 )
::oBtnList:hBitmap1 := ::aBitMaps[::nBtnBmp, BITMAP_HANDLE ]
::oBtnElip:cCaption := ""
else
::oBtnElip:hBitmap1 := 0
::oBtnList:hBitmap1 := 0
::oBtnElip:cCaption := "..."
endif

::oBrw:refresh()

return nil
Post Reply