Page 2 of 3

Re: Major bug in resource management

Posted: Thu Jul 29, 2010 8:02 pm
by Ricci
Hello Grigory !

Yes ty, it helps a lot ... but the GDI handles a still increasing, but slower. So i have to find other code bugs ;)

I will report when I found them.


Regards ... Ricci

Re: Major bug in resource management

Posted: Thu Jul 29, 2010 8:16 pm
by Ricci
Grigory, here is the next one to fix:

The command <ParentWindowName>.<ControlName>.Picture := cImageName for an IMAGE control increase the GDI handles with 1


Regards ... Ricci

Re: Major bug in resource management

Posted: Thu Jul 29, 2010 8:37 pm
by Ricci
Hello, Grigory !

Here are some more:

When creating a sub-window with DEFINE WINDOW <WindowName> and closing it with <WindowName>.Release you loose 2 GDI handles every time.

If you create a grafical Button is the window above with BUTTON <ControlName> ... PICTURE <cPictureName> you loose 4 GDI handles more when closing the window.


Enough for today ... :D


Regards ... Ricci

Re: Major bug in resource management

Posted: Fri Jul 30, 2010 2:15 am
by dhaine_adp
IMAGELIST_DESTROY ( _HMG_SYSDATA [ 37 ] [y] ) in the h_controlmisc.prg and recompile HMG library by batch file hmg\source\makehmg.bat.
Hello Grigory,

Thank you for posting the patch. Very fast indeed.

Regards,

Danny

Re: Major bug in resource management

Posted: Mon Aug 02, 2010 7:45 pm
by Ricci
Ok, i found the solution for the increasing GDI handles using the command <ParentWindowName>.<ControlName>.Picture := cImageName for an IMAGE control.

In c_image.c there is a HDC defined with
HDC tmp2DC = CreateCompatibleDC(imgDC);

but it´s not always deleted at the end of the function.

Here is the corrected file.

Regards ... Ricci

Re: Major bug in resource management

Posted: Mon Aug 02, 2010 8:19 pm
by Ricci
And another problem solved.

If you create a grafical button in a subwindow with BUTTON <ControlName> ... PICTURE <cPictureName> you loose 4 GDI handles more when releasing the window.

Here is the corrected file (I added some code at line number 2959)

Regard ... Ricci

Re: Major bug in resource management

Posted: Mon Aug 02, 2010 9:12 pm
by Rathinagiri
Thanks Ricci.

Let Roberto reviews the code and accommodates the changes.

Re: Major bug in resource management

Posted: Mon Aug 02, 2010 9:47 pm
by Ricci
rathinagiri wrote:Thanks Ricci.
Let Roberto reviews the code and accommodates the changes.
Now we only need a fix for the last error:

When creating a sub-window with DEFINE WINDOW <WindowName> and closing it with <WindowName>.Release you loose 2 GDI handles every time.

Re: Major bug in resource management

Posted: Tue Aug 03, 2010 3:54 pm
by Ricci
Ricci wrote:When creating a sub-window with DEFINE WINDOW <WindowName> and closing it with <WindowName>.Release you loose 2 GDI handles every time.
I was able to localize the error above but unable to fix it. A job for Grigory or Roberto this time ;-)

If you open a subwindow with this command:

Code: Select all

DEFINE WINDOW Form_2 ;
      AT 100,100 WIDTH 200 HEIGHT 100 
END WINDOW
ACTIVATE WINDOW Form_2
the program use 12 GDI handles. Closing it, 5 handles are released. If you open it a second time, only 5 handles are used and released when closing.
So this is OK.

Defining the window as MODAL, the behavior is changing:

Code: Select all

DEFINE WINDOW Form_2 ;
      AT 100,100 WIDTH 200 HEIGHT 100 MODAL     
END WINDOW
ACTIVATE WINDOW Form_2
The program still use 12 GDI handles the first time. But when closing it, only 3 handles are released. Opening it a second time 5 handles are used but every time only 3 GDI handles are released when closing.

So the program consume 2 GDI handles re(opening) and closing MODAL windows. Sounds little, but if you work a long time with a program it could be too much.

Regards ... Ricci

Re: Major bug in resource management

Posted: Sun Aug 08, 2010 3:01 pm
by Roberto Lopez
rathinagiri wrote:Thanks Ricci.

Let Roberto reviews the code and accommodates the changes.
I'll do ASAP.

Thanks!!!