Don't panic if WebGL thread can't be reached during finalization.

This commit is contained in:
Josh Matthews 2019-07-29 10:05:48 -04:00
parent eb4f2d150a
commit 8f5c37c0b5
8 changed files with 78 additions and 43 deletions

View file

@ -140,12 +140,16 @@ impl WebGLFramebuffer {
));
}
pub fn delete(&self) {
pub fn delete(&self, fallible: bool) {
if !self.is_deleted.get() {
self.is_deleted.set(true);
self.upcast::<WebGLObject>()
.context()
.send_command(WebGLCommand::DeleteFramebuffer(self.id));
let context = self.upcast::<WebGLObject>().context();
let cmd = WebGLCommand::DeleteFramebuffer(self.id);
if fallible {
context.send_command_ignored(cmd);
} else {
context.send_command(cmd);
}
}
}
@ -588,7 +592,7 @@ impl WebGLFramebuffer {
impl Drop for WebGLFramebuffer {
fn drop(&mut self) {
self.delete();
self.delete(true);
}
}