gtk4: Update for GLDisplay object lock requirements

This commit is contained in:
Sebastian Dröge 2023-02-06 11:10:02 +02:00
parent 6f26e3bf79
commit 5c2de6aeb6

View file

@ -732,17 +732,20 @@ impl PaintableSink {
"Successfully deactivated GL Context after fill_info" "Successfully deactivated GL Context after fill_info"
); );
let gst_context = match display.create_context(Some(app_ctx)) { let display_object_guard = display.object_lock();
Ok(gst_context) => gst_context, let gst_context =
Err(err) => { match gst_gl::GLDisplay::create_context(&display_object_guard, Some(app_ctx)) {
gst::error!(CAT, imp: self, "Could not create GL context: {err}"); Ok(gst_context) => gst_context,
*app_ctx_guard = None; Err(err) => {
*display_guard = None; gst::error!(CAT, imp: self, "Could not create GL context: {err}");
return false; 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(_) => { Ok(_) => {
let mut gst_ctx_guard = self.gst_context.lock().unwrap(); let mut gst_ctx_guard = self.gst_context.lock().unwrap();
gst::info!(CAT, imp: self, "Successfully initialized GL Context"); gst::info!(CAT, imp: self, "Successfully initialized GL Context");
@ -751,6 +754,7 @@ impl PaintableSink {
} }
Err(_) => { Err(_) => {
gst::error!(CAT, imp: self, "Could not add GL context to display"); gst::error!(CAT, imp: self, "Could not add GL context to display");
drop(display_object_guard);
*app_ctx_guard = None; *app_ctx_guard = None;
*display_guard = None; *display_guard = None;
false false