Export to GitHub

leaktrap - issue #1

Allow for multiple cleanup functions


Posted on Jan 22, 2009 by Swift Cat

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.

Comment #1

Posted on Jan 22, 2009 by Swift Cat

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.

Status: Accepted

Labels:
Type-Enhancement Priority-Low