Leak on TRibbon?

Leak on TRibbon?

Postby byte-one » Fri Jun 14, 2013 8:58 am

Antonio, should not the hBmp deleted unstead hBmpOld ???

Function from tRibbon:

Code: Select all  Expand view  RUN
function GradientBmp( oWnd, nWidth, nHeight, aColors )

   local hDC, hBmp, hBmpOld
   local aRect := GetClientRect( oWnd:hWnd )

   DEFAULT nHeight := aRect[ 3 ] , nWidth := aRect[ 4 ]

   hDC     = CreateCompatibleDC( oWnd:GetDC() )
   hBmp    = CreateCompatibleBitMap( oWnd:hDC, nWidth, nHeight )
   hBmpOld = SelectObject( hDC, hBmp )
   GradientFill( hDC, 0, 0, nHeight, nWidth, aColors )

   SelectObject( hDC, hBmpOld )
   DeleteDC( hDC )
   DeleteObject( hBmpOld ) //-------->>>>> DeleteObject( hBmp )
   oWnd:ReleaseDC()

return hBmp
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: Leak on TRibbon?

Postby byte-one » Fri Jun 14, 2013 10:18 am

No, my mistake!! The hBmp is the value to return!

But another growing GDI-consum i saw. In TQuickaccess the GDI-bmps are growing, if i stand with the mouse over one of the quickaccess-controls ( all ~seconds +1 GDI-object more)
Also at end from app when i check with checkres() there are three bmp from quickaccess unreleased!
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 48 guests