Reputation: 27713
From MSDN about IShellItemImageFactory::GetImage:
It is the responsibility of the caller to free this retrieved resource through DeleteObject when it is no longer needed.
My question is:
I'm using the IntPtr
in an IShellItemImageFactory.GetImage
call where the IShellItemImageFactory
is decorated with [ComImportAttribute()]
. Do I still need to call DeleteObject
, or will that cause trouble when the CLR(?) will try deleting it as part of the Factory
?
Upvotes: 1
Views: 455
Reputation: 942099
The CLR will never automatically release an IntPtr. It cannot possibly know what specific function needs to be called to release the pointer. It is entirely up to you to pinvoke DeleteObject().
Upvotes: 3