Overridden close closes before checking if already closed
dzaima opened this issue · 1 comments
dzaima commented
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.
Lines 59 to 64 in b3f2289
(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.
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();
?
tonsky commented
Yeah that makes sense. PR?