riQQ / leaktrap

Automatically exported from code.google.com/p/leaktrap
0 stars 0 forks source link

Allow for multiple cleanup functions #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Some resources are created using "heterogeneous" functions and can be
deleted through multiple cleanup functions.
Examples:
 HANDLE user32.LoadImage(      
    HINSTANCE hinst,
    LPCTSTR lpszName,
    UINT uType,
    int cxDesired,
    int cyDesired,
    UINT fuLoad
 );
creates handles of 3 (three) different types which are (according to
documentation) should also be removed using a particular cleanup:
Bitmap - DeleteObject
Cursor - DestroyCursor
Icon   - DestroyIcon
but in practice I've seen commercial libraries using DeleteObject for all
cases which leads me to believe it is beneficial that multiple ways to
cleanup are allowed.

Original issue reported on code.google.com by deemok@googlemail.com on 22 Jan 2009 at 9:16

GoogleCodeExporter commented 9 years ago
Also, some functions:
user32.int SetWindowRgn(
  HWND hWnd,     // handle to window
  HRGN hRgn,     // handle to region
  BOOL bRedraw   // window redraw option
); for example, transfer the handle ownership to the system when a handle is
destroyed automatically after it is no longer needed - such a case would also be
covered by introducing multiple cleanups and assigning it as an explicit 
cleanup for
HRGN handles.

Original comment by deemok@googlemail.com on 22 Jan 2009 at 9:21