diff options
author | Josh Matthews <josh@joshmatthews.net> | 2019-07-29 10:05:48 -0400 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2019-07-29 10:09:24 -0400 |
commit | 8f5c37c0b5011fa526f2b932bf7abb0bca8a7fd0 (patch) | |
tree | 50609b21c4f98bd0b89677d783a3aefbb765ce9e /components/script/dom/webglvertexarrayobjectoes.rs | |
parent | eb4f2d150af353ecbae3eacb23b32b4ac0970ce8 (diff) | |
download | servo-8f5c37c0b5011fa526f2b932bf7abb0bca8a7fd0.tar.gz servo-8f5c37c0b5011fa526f2b932bf7abb0bca8a7fd0.zip |
Don't panic if WebGL thread can't be reached during finalization.
Diffstat (limited to 'components/script/dom/webglvertexarrayobjectoes.rs')
-rw-r--r-- | components/script/dom/webglvertexarrayobjectoes.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/components/script/dom/webglvertexarrayobjectoes.rs b/components/script/dom/webglvertexarrayobjectoes.rs index 871de741c39..22d162782d8 100644 --- a/components/script/dom/webglvertexarrayobjectoes.rs +++ b/components/script/dom/webglvertexarrayobjectoes.rs @@ -57,16 +57,20 @@ impl WebGLVertexArrayObjectOES { self.is_deleted.get() } - pub fn delete(&self) { + pub fn delete(&self, fallible: bool) { assert!(self.id.is_some()); if self.is_deleted.get() { return; } self.is_deleted.set(true); - self.upcast::<WebGLObject>() - .context() - .send_command(WebGLCommand::DeleteVertexArray(self.id.unwrap())); + let context = self.upcast::<WebGLObject>().context(); + let cmd = WebGLCommand::DeleteVertexArray(self.id.unwrap()); + if fallible { + context.send_command_ignored(cmd); + } else { + context.send_command(cmd); + } for attrib_data in &**self.vertex_attribs.borrow() { if let Some(buffer) = attrib_data.buffer() { @@ -248,7 +252,7 @@ impl WebGLVertexArrayObjectOES { impl Drop for WebGLVertexArrayObjectOES { fn drop(&mut self) { if self.id.is_some() { - self.delete(); + self.delete(true); } } } |