diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2022-12-29 11:56:56 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2023-01-07 14:24:48 +0300 |
commit | 37dedfd4d062f776777d44a3b1a9e615d042319c (patch) | |
tree | 9500ad0d4454fa64c5606fbcd8d4d8cf8b38bbfe /video | |
parent | bb2f632c9c340eed237aa0965335a3ad75be0cb0 (diff) |
gtk4: Reset app context and display if GL context creation fails
No need to keep them around and that way we either have all 3 values set
or none of them.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1038>
Diffstat (limited to 'video')
-rw-r--r-- | video/gtk4/src/sink/imp.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/video/gtk4/src/sink/imp.rs b/video/gtk4/src/sink/imp.rs index 4dea878e6..8a9332ed0 100644 --- a/video/gtk4/src/sink/imp.rs +++ b/video/gtk4/src/sink/imp.rs @@ -678,6 +678,8 @@ impl PaintableSink { Ok(_) => gst::info!(CAT, imp: self, "Successfully activated GL Context."), Err(_) => { gst::error!(CAT, imp: self, "Failed to activate GL context",); + *app_ctx_guard = None; + *display_guard = None; return false; } }; @@ -696,12 +698,16 @@ impl PaintableSink { "Failed to deactivate the context after failing fill info", ); } + *app_ctx_guard = None; + *display_guard = None; return false; } if app_ctx.activate(false).is_err() { gst::error!(CAT, imp: self, "Failed to deactivate GL context",); + *app_ctx_guard = None; + *display_guard = None; return false; } @@ -720,6 +726,8 @@ impl PaintableSink { } Err(err) => { gst::error!(CAT, imp: self, "Could not create GL context: {err}"); + *app_ctx_guard = None; + *display_guard = None; false } } |