Major bug in resource management

Moderator: Rathinagiri

Ricci
Posts: 255
Joined: Thu Nov 19, 2009 2:23 pm

Re: Major bug in resource management

Post 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
Ricci
Posts: 255
Joined: Thu Nov 19, 2009 2:23 pm

Re: Major bug in resource management

Post 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
Last edited by Ricci on Thu Jul 29, 2010 8:50 pm, edited 2 times in total.
Ricci
Posts: 255
Joined: Thu Nov 19, 2009 2:23 pm

Re: Major bug in resource management

Post 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
User avatar
dhaine_adp
Posts: 457
Joined: Wed Aug 06, 2008 12:22 pm
Location: Manila, Philippines

Re: Major bug in resource management

Post 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
Regards,

Danny
Manila, Philippines
Ricci
Posts: 255
Joined: Thu Nov 19, 2009 2:23 pm

Re: Major bug in resource management

Post 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
Attachments
c_image-upd.zip
(2.89 KiB) Downloaded 260 times
Ricci
Posts: 255
Joined: Thu Nov 19, 2009 2:23 pm

Re: Major bug in resource management

Post 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
Attachments
h_windows-upd.zip
(26.63 KiB) Downloaded 274 times
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Major bug in resource management

Post by Rathinagiri »

Thanks Ricci.

Let Roberto reviews the code and accommodates the changes.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
Ricci
Posts: 255
Joined: Thu Nov 19, 2009 2:23 pm

Re: Major bug in resource management

Post 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.
Ricci
Posts: 255
Joined: Thu Nov 19, 2009 2:23 pm

Re: Major bug in resource management

Post 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
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Major bug in resource management

Post by Roberto Lopez »

rathinagiri wrote:Thanks Ricci.

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

Thanks!!!
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
Post Reply