mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Don't panic if WebGL thread can't be reached during finalization.
This commit is contained in:
parent
eb4f2d150a
commit
8f5c37c0b5
8 changed files with 78 additions and 43 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue