diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2023-02-06 12:10:02 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2023-02-06 12:10:02 +0300 |
commit | 5c2de6aeb64be090741cd2a98def4519ac3a4ab1 (patch) | |
tree | 46de5ce31f3f024561770486c8c0c566e6af7f78 /video | |
parent | 6f26e3bf791e6e151eb7469826f74599a1b043ee (diff) |
gtk4: Update for `GLDisplay` object lock requirements
Diffstat (limited to 'video')
-rw-r--r-- | video/gtk4/src/sink/imp.rs | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/video/gtk4/src/sink/imp.rs b/video/gtk4/src/sink/imp.rs index df6c0c91..7bf82eee 100644 --- a/video/gtk4/src/sink/imp.rs +++ b/video/gtk4/src/sink/imp.rs @@ -732,17 +732,20 @@ impl PaintableSink { "Successfully deactivated GL Context after fill_info" ); - let gst_context = match display.create_context(Some(app_ctx)) { - Ok(gst_context) => gst_context, - Err(err) => { - gst::error!(CAT, imp: self, "Could not create GL context: {err}"); - *app_ctx_guard = None; - *display_guard = None; - return false; - } - }; + let display_object_guard = display.object_lock(); + let gst_context = + match gst_gl::GLDisplay::create_context(&display_object_guard, Some(app_ctx)) { + Ok(gst_context) => gst_context, + Err(err) => { + gst::error!(CAT, imp: self, "Could not create GL context: {err}"); + drop(display_object_guard); + *app_ctx_guard = None; + *display_guard = None; + return false; + } + }; - match display.add_context(&gst_context) { + match gst_gl::GLDisplay::add_context(&display_object_guard, &gst_context) { Ok(_) => { let mut gst_ctx_guard = self.gst_context.lock().unwrap(); gst::info!(CAT, imp: self, "Successfully initialized GL Context"); @@ -751,6 +754,7 @@ impl PaintableSink { } Err(_) => { gst::error!(CAT, imp: self, "Could not add GL context to display"); + drop(display_object_guard); *app_ctx_guard = None; *display_guard = None; false |