Page 1 of 1

XBrowse metodo ChangeBitmap() pierde recursos

Posted: Thu Jan 29, 2015 12:52 pm
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.

Re: XBrowse metodo ChangeBitmap() pierde recursos

Posted: Fri Jan 30, 2015 9:33 am
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 ]
 

Re: XBrowse metodo ChangeBitmap() pierde recursos

Posted: Thu Feb 05, 2015 9:31 am
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