Vincent Povirk madewokherd@gmail.com wrote:
You appear to be leaking the IWICBitmapLock object.
Yeah, it's an omission on my part, thanks.
Also, it seems odd that you're using the buffer AND IWICBitmapLock. I assume the point of passing a buffer to BitmapImpl_Create (and wasting a bit of time/memory) was to avoid IWICBitmapLock.
BitmapImpl_Create creates its own internal buffer for a WIC bitmap bits, while 'buffer' is used to store GDI bitmap bits. The only way to access WIC bitmap bits from ComponentFactory is using IWICBitmapLock (to not break the object separation/implementation detail rules). And 'buffer' is reused twice: once for GDI image bits, and next time for the GDI mask bits.