IosBitmap.recycle() crash (#332)
This commit is contained in:
@@ -46,7 +46,7 @@ public class IosBitmap implements Bitmap {
|
|||||||
|
|
||||||
static final Logger log = LoggerFactory.getLogger(IosBitmap.class);
|
static final Logger log = LoggerFactory.getLogger(IosBitmap.class);
|
||||||
|
|
||||||
final CGBitmapContext cgBitmapContext;
|
CGBitmapContext cgBitmapContext;
|
||||||
final int width;
|
final int width;
|
||||||
final int height;
|
final int height;
|
||||||
private int glInternalFormat = Integer.MIN_VALUE;
|
private int glInternalFormat = Integer.MIN_VALUE;
|
||||||
@@ -158,10 +158,14 @@ public class IosBitmap implements Bitmap {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recycle() {
|
public void recycle() {
|
||||||
if (this.cgBitmapContext != null) this.cgBitmapContext.release();
|
//CGContext.close() will close the object and release any system resources it holds.
|
||||||
|
if (this.cgBitmapContext != null) {
|
||||||
|
this.cgBitmapContext.close();
|
||||||
|
this.cgBitmapContext = null;
|
||||||
|
}
|
||||||
if (this.directPixelBuffer != null) {
|
if (this.directPixelBuffer != null) {
|
||||||
//cgBitmapContext.release() will also release the directPixelBuffer
|
this.directPixelBuffer.clear();
|
||||||
this.directPixelBuffer = null; //only hint for GC
|
this.directPixelBuffer = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user