aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webglshader.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2019-07-29 10:05:48 -0400
committerJosh Matthews <josh@joshmatthews.net>2019-07-29 10:09:24 -0400
commit8f5c37c0b5011fa526f2b932bf7abb0bca8a7fd0 (patch)
tree50609b21c4f98bd0b89677d783a3aefbb765ce9e /components/script/dom/webglshader.rs
parenteb4f2d150af353ecbae3eacb23b32b4ac0970ce8 (diff)
downloadservo-8f5c37c0b5011fa526f2b932bf7abb0bca8a7fd0.tar.gz
servo-8f5c37c0b5011fa526f2b932bf7abb0bca8a7fd0.zip
Don't panic if WebGL thread can't be reached during finalization.
Diffstat (limited to 'components/script/dom/webglshader.rs')
-rw-r--r--components/script/dom/webglshader.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/components/script/dom/webglshader.rs b/components/script/dom/webglshader.rs
index 18ec81b1a98..eae89fe3dcb 100644
--- a/components/script/dom/webglshader.rs
+++ b/components/script/dom/webglshader.rs
@@ -178,12 +178,16 @@ impl WebGLShader {
/// Mark this shader as deleted (if it wasn't previously)
/// and delete it as if calling glDeleteShader.
/// Currently does not check if shader is attached
- pub fn mark_for_deletion(&self) {
+ pub fn mark_for_deletion(&self, fallible: bool) {
if !self.marked_for_deletion.get() {
self.marked_for_deletion.set(true);
- self.upcast::<WebGLObject>()
- .context()
- .send_command(WebGLCommand::DeleteShader(self.id));
+ let context = self.upcast::<WebGLObject>().context();
+ let cmd = WebGLCommand::DeleteShader(self.id);
+ if fallible {
+ context.send_command_ignored(cmd);
+ } else {
+ context.send_command(cmd);
+ }
}
}
@@ -230,6 +234,6 @@ impl WebGLShader {
impl Drop for WebGLShader {
fn drop(&mut self) {
- self.mark_for_deletion();
+ self.mark_for_deletion(true);
}
}