Solved GDI leak in mimg...

Report bugs and possible workarounds.
KimF
Finland
Posts: 23
Joined: 04 May 2017, 03:49
Location: Finland

GDI leak in mimg...

Post by KimF » 17 May 2019, 06:04

Hello, it seems that when using MImgCreateHICON( ) and then MImgDelete( ), it increase application's qty of GDIs

As attachment is an test case
#1 button opens form without using MImgCreateHICON( )
#2 button opens form using MImgCreateHICON( ) and MImgDelete( ) for 1 icon
#3 button opens form using MImgCreateHICON( ) and MImgDelete( ) for 2 icons
#4 button opens form using MImgCreateHICON( ) and MImgDelete( ) for 3 icons
#5 button opens form using MImgCreateHICON( ) and MImgDelete( ) for 4 icons

The more icons, the more GDIs are added to application

By uncommenting form,'s SAM_CreateComplete message icons are shown in buttons

Kim
You do not have the required permissions to view the files attached to this post.
Last edited by KimF on 23 May 2019, 07:01, edited 1 time in total.

ulle
Germany
Posts: 35
Joined: 29 May 2017, 09:25
Location: Germany

Re: GDI leak in mimg...

Post by ulle » 17 May 2019, 07:01

Hello Kim,

you have to use DestroyIcon (winapi), see Remarks below.

Regards
ulle

--------------------
MImgHelp

hIcon = MImgCreateHICON( hImage )
Creates a HICON from an image.

Parameters
hImage
Number: Handle of the image

Return
Number: Handle of the icon if successful or 0 if an error occurs

Example
In this example an icon is created and displayed in a picture:

Set hIcon = MImgCreateHICON( hImage )
Call SalPicSetHandle( pic1, PIC_FormatIcon, hIcon )

Remarks
Don't forget to delete the created icon with DestroyIcon.


KimF
Finland
Posts: 23
Joined: 04 May 2017, 03:49
Location: Finland

Re: GDI leak in mimg...

Post by KimF » 17 May 2019, 08:05

Thanks Ulle, I changed in forms SAM_Destroy MImgDelete( ) -> DestroyIcon( )

DestroyIcon( ) is in External Functions
Library name: user32.dll

Still GDI is growing every time form is opened - even when its run as an application
You can test with new attachment

Kim
You do not have the required permissions to view the files attached to this post.

micsto
Germany
Posts: 745
Joined: 07 Mar 2017, 16:07
Location: Germany

Re: GDI leak in mimg...

Post by micsto » 22 May 2019, 07:09

It's a bug in CxImage (third party library used by M!Image) :/
I've fixed the bug and I'm going to release a new M!Image version soon.

Attached you'll find the fixed version for TD 7.1 32bit.

Michael
You do not have the required permissions to view the files attached to this post.

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 0 guests