I'm using C++ Builder XE7. Whenever a form resizes I need to rebuild a D2D bitmap, which I create with CreateBitmap(). As this will quickly eat up all video memory, I want to destroy the previous bitmap before creating a new one. Oddly enough I cannot find any information how to destroy this _di_ID2D1Bitmap. I tried the Release() method but that just gives me an AV in line 291 of systobj.h.
What is the proper way to destroy a _di_ID2D1Bitmap?
Thanks.
ID2D1Bitmap
interface, just remove all references to it (eg.mySavedBMPRef = null
). – Peter Kostov_di_ID2D1Bitmap
is aDelphiInterface
. A variable of that type is a pointer. You don't have to free it manually, because there is an automatic reference counting - ie - when there are no references left, it will be freed automatically. In short, if you have a pointerP
holding just one reference to yourID2D1Bitmap
, when you pass it to theCreateBitmap()
it will acquire a ref to the new bitmap while the old one will became with 0 references and will be freed. – Peter Kostov