Skip to content
This repository has been archived by the owner on Mar 17, 2022. It is now read-only.

Commit

Permalink
don’t recycle native pix from java finalizers.
Browse files Browse the repository at this point in the history
  • Loading branch information
renard314 authored and rmtheis committed Jun 14, 2015
1 parent c982398 commit 44627d8
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions tess-two/src/com/googlecode/leptonica/android/Pix.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,6 @@ public void recycle() {
}
}

@Override
protected void finalize() throws Throwable {
recycle();

super.finalize();
}

/**
* Creates a new Pix from raw Pix data obtained from getData().
*
Expand Down Expand Up @@ -238,6 +231,9 @@ public int getDepth() {
return nativeGetDepth(mNativePix);
}

public int getRefCount(){
return nativeGetRefCount(mNativePix);
}
/**
* Returns the {@link android.graphics.Color} at the specified location.
*
Expand Down Expand Up @@ -280,6 +276,7 @@ public void setPixel(int x, int y, int color) {
// * NATIVE CODE *
// ***************

private static native int nativeGetRefCount(long nativePix);
private static native long nativeCreatePix(int w, int h, int d);
private static native long nativeCreateFromData(byte[] data, int w, int h, int d);
private static native byte[] nativeGetData(long nativePix);
Expand Down

0 comments on commit 44627d8

Please sign in to comment.