From b689a0825e44138131d26f0cc01cfd996d36f747 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Tue, 6 Dec 2022 20:28:16 +0200 Subject: [PATCH] gtk4: Deactivate the context if we fail to fill_info Avoid leaving the context activated if we end up erroring out. Similar to https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3492 Part-of: --- video/gtk4/src/sink/imp.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/video/gtk4/src/sink/imp.rs b/video/gtk4/src/sink/imp.rs index ad436af5..992180f3 100644 --- a/video/gtk4/src/sink/imp.rs +++ b/video/gtk4/src/sink/imp.rs @@ -670,6 +670,16 @@ impl PaintableSink { "Failed to fill info on the GL Context: {}", &err ); + // Deactivate the context upon failure + if let Err(err) = app_ctx_guard.as_ref().unwrap().activate(false) { + gst::error!( + CAT, + imp: self, + "Failed to deactivate the context after failing fill info: {}", + &err + ); + } + return Err(err); } };