Skip to content

Commit

Permalink
Add missing panic check in drop impl (#287)
Browse files Browse the repository at this point in the history
All other `panic!`s in drop implementation check
first if the thread is already panicking.

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
  • Loading branch information
jschwe committed Apr 27, 2024
1 parent f63f3e4 commit 6ad94f9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion surfman/src/renderbuffers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::context::{ContextAttributeFlags, ContextAttributes};
use crate::gl;
use crate::gl::types::GLuint;
use crate::Gl;
use std::thread;

use euclid::default::Size2D;

Expand All @@ -22,7 +23,11 @@ impl Drop for Renderbuffers {
stencil: 0,
}
| Renderbuffers::CombinedDepthStencil(0) => {}
_ => panic!("Should have destroyed the FBO renderbuffers with `destroy()`!"),
_ => {
if !thread::panicking() {
panic!("Should have destroyed the FBO renderbuffers with `destroy()`!")
}
}
}
}
}
Expand Down

0 comments on commit 6ad94f9

Please sign in to comment.