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: 9618
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


Return to madExcept

Who is online

Users browsing this forum: No registered users and 3 guests

cron