Closed dzaima closed 2 years ago
The close method in Managed has a check for whether _ptr is zero, and throws an error if so. But if the method is overridden, e.g. https://github.com/HumbleUI/JWM/blob/b3f2289ce4635ce53219cddd00809e7fdcc4008c/shared/java/LayerGL.java#L59-L64 (this kind of thing happens in most overridden close methods) then the native close method will be called before that, resulting in a segfault, which is a lot less clear on what has happened.
close
Managed
_ptr
This is a pretty minor thing all things considered, as it only affects code that's already incorrect, but I think it's still worth fixing.
Maybe replace assert _onUIThread(); with assert _onUIThread() && !isClosed();?
assert _onUIThread();
assert _onUIThread() && !isClosed();
Yeah that makes sense. PR?
The
close
method inManaged
has a check for whether_ptr
is zero, and throws an error if so. But if the method is overridden, e.g. https://github.com/HumbleUI/JWM/blob/b3f2289ce4635ce53219cddd00809e7fdcc4008c/shared/java/LayerGL.java#L59-L64 (this kind of thing happens in most overriddenclose
methods) then the native close method will be called before that, resulting in a segfault, which is a lot less clear on what has happened.This is a pretty minor thing all things considered, as it only affects code that's already incorrect, but I think it's still worth fixing.
Maybe replace
assert _onUIThread();
withassert _onUIThread() && !isClosed();
?