In NativeObjectManager around line 130, there is
[java]
if (ref2 == null) {
throw new IllegalArgumentException("This NativeObject is not " +
“registered in this NativeObjectManager”);
}
assert ref == null || ref == ref2;
int id = obj.getId();
// Delete object from the GL driver
obj.deleteObject(rendererObject);
assert obj.getId() == NativeObject.INVALID_ID;
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST, "Deleted: {0}", obj.getClass().getSimpleName() + "/" + id);
}
[/java]
The above code throws an exception which is hard to catch and process, because the object remover is almost always called through the system renderer, which is furthermore called automatically through the run thread on the GL surface. Since it’s not a very critical exception, I was wondering why it’s not done like this:
[java]
if (ref2 != null) {
assert ref == null || ref == ref2;
int id = obj.getId();
// Delete object from the GL driver
obj.deleteObject(rendererObject);
assert obj.getId() == NativeObject.INVALID_ID;
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST, "Deleted: {0}", obj.getClass().getSimpleName() + "/" + id);
}
} else {
return false;
}
[/java]
That way, the error can still be processed while the app keeps running.