Wrong detected resource leak

delphi package - automated exception handling

Wrong detected resource leak

Postby MarcoNica » Fri Feb 16, 2018 12:38 pm

I'm using madExcept 4.0.19 and get a wrong report for a resource leak in the code below.
MadExcept reports a leaked region that was created in CreateRectRgnIndirect.
But windows will manage the release of the region because GetDCEx with the flag DCX_INTERSECTRGN was called.

Here a little summary from the Microsoft documentation for the GetDcEx call:
hrgnClip [in]
A clipping region that may be combined with the visible region of the DC. If the value of flags is DCX_INTERSECTRGN or DCX_EXCLUDERGN, then the operating system assumes ownership of the region and will automatically delete it when it is no longer needed. In this case, the application should not use or delete the region after a successful call to GetDCEx.



Code: Select all
var
  rgn: HRGN;
  dc: HDC;
  nullRect: TRect;
begin
  nullRect := Rect(0,0,0,0);
  rgn := CreateRectRgnIndirect(nullRect);
  dc := GetDCEx(Handle, rgn, DCX_PARENTCLIP or DCX_CLIPSIBLINGS or DCX_INTERSECTRGN);
  ReleaseDC(Handle, dc);
end;
MarcoNica
 
Posts: 2
Joined: Fri Feb 16, 2018 12:24 pm

Re: Wrong detected resource leak

Postby madshi » Fri Feb 16, 2018 2:52 pm

Good catch, thanks for letting me know! I'll fix this for the next build.
madshi
Site Admin
 
Posts: 9650
Joined: Sun Mar 21, 2004 5:25 pm

Re: Wrong detected resource leak

Postby MarcoNica » Mon Feb 19, 2018 7:38 am

Thank you for the fast replay.
MarcoNica
 
Posts: 2
Joined: Fri Feb 16, 2018 12:24 pm

Re: Wrong detected resource leak

Postby anders_g » Thu Apr 19, 2018 9:13 am

Any timeframe for next build?
/Anders
anders_g
 
Posts: 1
Joined: Wed Dec 27, 2017 7:56 am

Re: Wrong detected resource leak

Postby madshi » Thu May 17, 2018 11:56 am

I'm sorry for the delay in answering and fixing. I've now fixed this issue in my sources and the fix will be included in the next build, which I hope should be out later this week or early next week.
madshi
Site Admin
 
Posts: 9650
Joined: Sun Mar 21, 2004 5:25 pm

Re: Wrong detected resource leak

Postby pp » Thu May 24, 2018 7:52 am

^ Friendly bump. Do you have a timeframe?

I have some codes from DevExpress that MadExcept / resources is flagging resource errors.
pp
 
Posts: 2
Joined: Fri Dec 19, 2008 8:26 am

Re: Wrong detected resource leak

Postby madshi » Thu May 24, 2018 8:50 am

Sorry. You can use the latest beta build which (I think) has this fix included:

http://madshi.net/madCollectionBeta.exe

If not, let me know, then I'll recompile and upload a new build.
madshi
Site Admin
 
Posts: 9650
Joined: Sun Mar 21, 2004 5:25 pm


Return to madExcept

Who is online

Users browsing this forum: pp and 3 guests