mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-10-31 22:58:51 +00:00
gtk4: Fix segfault running gst-inspect -a
when GTK4 and GTK3 is installed
Segmentation fault when getting default value of paintable property from gtk4paintablesink element when libgtk-4.so.1 from libgstgtk4.so and libgtk-3.so.0 from libgstgtk.so are installed: > cannot register existing type 'GdkDisplayManager' Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/490 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1453>
This commit is contained in:
parent
cf5e7f6ed3
commit
09e9c047df
1 changed files with 8 additions and 0 deletions
|
@ -99,6 +99,14 @@ impl ObjectImpl for PaintableSink {
|
|||
fn property(&self, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.name() {
|
||||
"paintable" => {
|
||||
// Fix segfault when GTK3 and GTK4 are loaded (e.g. `gst-inspect-1.0 -a`)
|
||||
// checking if GtkBin is registered to know if libgtk3.so is already present
|
||||
// GtkBin was dropped for GTK4 https://gitlab.gnome.org/GNOME/gtk/-/commit/3c165b3b77
|
||||
if glib::types::Type::from_name("GtkBin").is_some() {
|
||||
gst::error!(CAT, imp: self, "Skipping the creation of paintable to avoid segfault between GTK3 and GTK4");
|
||||
return None::<&gdk::Paintable>.to_value();
|
||||
}
|
||||
|
||||
let mut paintable = self.paintable.lock().unwrap();
|
||||
if paintable.is_none() {
|
||||
self.create_paintable(&mut paintable);
|
||||
|
|
Loading…
Reference in a new issue