Commit afea771c authored by Romain Vimont's avatar Romain Vimont Committed by Geoffrey Métais

Assert refcount == 0 on finalize

VLCObject manages a refcount to release native resources. If the Java
object is finalized, this is an error if the refcount is not 0
(native resources have not been released as expected).
Signed-off-by: default avatarGeoffrey Métais <geoffrey.metais@gmail.com>
parent f5087074
......@@ -91,6 +91,12 @@ abstract class VLCObject<T extends VLCEvent> {
}
}
@Override
protected synchronized void finalize() {
if (!isReleased())
throw new AssertionError("VLCObject (" + getClass().getName() + ") finalized but not natively released (" + mNativeRefCount + " refs)");
}
/**
* Set an event listener.
* Events are sent via the android main thread.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment