We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 7aeb1ba + f2d8a68 commit e61aa98Copy full SHA for e61aa98
plotters/src/drawing/backend_impl/mocked.rs
@@ -269,6 +269,13 @@ impl DrawingBackend for MockedBackend {
269
270
impl Drop for MockedBackend {
271
fn drop(&mut self) {
272
+ // `self.drop_check` is typically a testing function; it can panic.
273
+ // The current `drop` call may be a part of stack unwinding caused
274
+ // by another panic. If so, we should never call it.
275
+ if std::thread::panicking() {
276
+ return;
277
+ }
278
+
279
let mut temp = None;
280
std::mem::swap(&mut temp, &mut self.drop_check);
281
0 commit comments