About : tracing GDI resources

About : tracing GDI resources

Postby ukoenig » Fri Nov 20, 2009 9:01 pm

Hello,

I noticed during intensiv testing GDI resources,
the Brushes called with :
oLbx:SetBackGround( oBrush )
and in Folders :
oImageList:AddMasked( TBitmap():Define( "show",, oDlg ), nRGB( 192, 192, 192 ) )
are added again and again to the List, after closing and reopening the Dialog.
A Test with a closed Dialog, still shows the Brushes from Browsers and Tabs :

Image

The Browser-Brush is defined once on top of the Application, for all Browser-Backgrounds inside the Dialog. 27 Browsers are opened in 8 Folder-Pages like :
...
...
oLbx1 := TXBrowse():New( oFld:aDialogs[1] )
...
oLbx:SetBackGround( oBrush )
...
oLbx:CreateFromResource( 110 )


The Dialog includes a Folder with 8 Pages used like :
...
...
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT SetImages(oDlg,oFld)

RETURN NIL

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

function SetImages(oDlg, oFld)
local oImageList

DEFINE IMAGELIST oImageList SIZE 16, 16

oImageList:AddMasked( TBitmap():Define( "show",, oDlg ), nRGB( 192, 192, 192 ) )
oImageList:AddMasked( TBitmap():Define( "show",, oDlg ), nRGB( 192, 192, 192 ) )
oImageList:AddMasked( TBitmap():Define( "show",, oDlg ), nRGB( 192, 192, 192 ) )
oImageList:AddMasked( TBitmap():Define( "show",, oDlg ), nRGB( 192, 192, 192 ) )
oImageList:AddMasked( TBitmap():Define( "show",, oDlg ), nRGB( 192, 192, 192 ) )
oImageList:AddMasked( TBitmap():Define( "show",, oDlg ), nRGB( 192, 192, 192 ) )
oImageList:AddMasked( TBitmap():Define( "show",, oDlg ), nRGB( 192, 192, 192 ) )
oImageList:AddMasked( TBitmap():Define( "show",, oDlg ), nRGB( 192, 192, 192 ) )

oFld:SetImageList( oImageList )

return nil
Last edited by ukoenig on Tue Nov 24, 2009 12:58 am, edited 2 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: About : tracing GDI resources

Postby nageswaragunupudi » Sat Nov 21, 2009 12:08 pm

It is a known issue. After a dialog is closed, the brush / font is not released.

Please see the discussion
viewtopic.php?f=3&t=16110&hilit=RELEASE+BRUSH&start=0

The issue is yet to be resolved.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: About : tracing GDI resources

Postby ukoenig » Sat Nov 21, 2009 1:04 pm

Thank You very much for the Information.

I tested with oBrush:nCount and the Counter shows 0 after closing the Dialog.

It means, the Informations in Function CheckRes() are misleading.
Maybe we can check the Brush-Counter, before adding a Brush-Info to the aResources-Array ???

IF TRIM(aResources[n][1]) = "BRUSH" .and. ????

Code: Select all  Expand view

FUNCTION CheckRes()
LOCAL oDlg70, hDC, oBrw1, oBMP70, oBtn70
LOCAL n, a := 0,  b := 0, c := 0, d := 0, aResNew := {}
LOCAL oSAY1, oSAY2, oSAY3, oSAY4, oSAY11, oSAY12, oSAY13, oSAY14
LOCAL  aGrad1 := { { W_MOVE, W_COLOR1, W_COLOR2 }, ;
                                    { W_MOVE, W_COLOR2, W_COLOR1 } }  
FOR n = 1 to Len( aResources )
   IF aResources[ n, 2 ] != 0
      AAdd( aResNew, { n, aResources[n][1], aResources[n][2], aResources[n][3] } )
      // The GDI-Counter
      IF TRIM(aResources[n][1]) = "BRUSH"
         a++
      ENDIF
      IF TRIM(aResources[n][1]) = "BMP"
         b++
      ENDIF
      IF TRIM(aResources[n][1]) = "FONT"
         c++
      ENDIF
      IF TRIM(aResources[n][1]) = "PAL"
         d++
      ENDIF
   ENDIF
NEXT
...
...
 

Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: About : tracing GDI resources

Postby nageswaragunupudi » Sat Nov 21, 2009 4:28 pm

Please try this code
Code: Select all  Expand view
#include "fivewin.ch"

func main()

   local oDlg, oBrush, aCount := {}

   DEFINE BRUSH oBrush STYLE CROSS
   AAdd( aCount, { 'After Creation', oBrush:nCount } )

   DEFINE DIALOG oDlg BRUSH oBrush
   AAdd( aCount, { 'After Define Dialog', oBrush:nCount } )

   ACTIVATE DIALOG oDlg CENTERED ON RIGHT CLICK ;
      AAdd( aCount, { 'Inside Dialog', oBrush:nCount } )

   AAdd( aCount, { 'After Dlg Exit', oBrush:nCount } )

   oBrush:End()
   AAdd( aCount, { 'After oBrush:End()', oBrush:nCount } )

   xbrowse( aCount )

return nil
 

Here is the result
Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: About : tracing GDI resources

Postby Antonio Linares » Sat Nov 21, 2009 8:24 pm

Rao, Uwe,

It was a bug in Class TDialog. This is the fix :-)

Code: Select all  Expand view
METHOD End( nResult ) CLASS TDialog
   ...
      EndDialog( ::hWnd, nResult )
      // ::hWnd = 0  // A.L. 22/04/03     Comment this line !!!
   ...
 


Image

Fix included for next FWH 9.11
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: About : tracing GDI resources

Postby nageswaragunupudi » Sun Nov 22, 2009 4:08 am

Many Thanks Mr. Antonio

This is really a very important fix.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: About : tracing GDI resources

Postby ukoenig » Tue Nov 24, 2009 12:29 am

There is still one Question about the BMP'S, defined for Folder-Tabs.
After reopening a Dialog I can see, the 8 BMP's are doubled inside the List.
Always 8 Times as BMP and 8 Times as PAL from :

Dialog opened the first Time, Lines : 48 - 63
Image
Dialog opend the second Time, Lines Lines : 48 - 63 and Lines 98 - 113
Image

in Function Tools => Line 584
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT SetImages(oDlg,oFld)

--------------------------------

function SetImages(oDlg, oFld)
local oImageList

DEFINE IMAGELIST oImageList SIZE 16, 16

oImageList:AddMasked( TBitmap():Define( "show",, oDlg ), nRGB( 192, 192, 192 ) )
oImageList:AddMasked( TBitmap():Define( "show",, oDlg ), nRGB( 192, 192, 192 ) )
oImageList:AddMasked( TBitmap():Define( "show",, oDlg ), nRGB( 192, 192, 192 ) )
oImageList:AddMasked( TBitmap():Define( "show",, oDlg ), nRGB( 192, 192, 192 ) )
oImageList:AddMasked( TBitmap():Define( "show",, oDlg ), nRGB( 192, 192, 192 ) )
oImageList:AddMasked( TBitmap():Define( "show",, oDlg ), nRGB( 192, 192, 192 ) )
oImageList:AddMasked( TBitmap():Define( "show",, oDlg ), nRGB( 192, 192, 192 ) )
oImageList:AddMasked( TBitmap():Define( "show",, oDlg ), nRGB( 192, 192, 192 ) )

oFld:SetImageList( oImageList )

return nil

Best Regards
Uwe :lol:
Last edited by ukoenig on Tue Nov 24, 2009 8:51 pm, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: About : tracing GDI resources

Postby Antonio Linares » Tue Nov 24, 2009 1:28 am

Uwe,

Please modify Class TFolder Method Destroy() this way:
Code: Select all  Expand view
METHOD Destroy() CLASS TFolder

   ...

   if ::oImageList != nil
      ::oImageList:End()
   endif  

return Super:Destroy()
 

That should solve it :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: About : tracing GDI resources

Postby ukoenig » Tue Nov 24, 2009 8:47 pm

Antonio,

Thank You very much.
The Change works perfect. The Folder-Tab BMP's are not counted anymore.
I still added a Main-Dialog-Counter.
Brushes are excluded from the 1. Browser. Í'm working on a Solution, to show them inside a extra Browser.

Image

Still 14 Positions after 3 Dialog-openings on Mainwindow-Level.

Image

Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: About : tracing GDI resources

Postby Antonio Linares » Wed Nov 25, 2009 1:20 am

Uwe,

Many thanks for your great feedback :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

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