From 3c248250f31f3d6d4f115444d67d7a34c85f081e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Tue, 24 May 2022 16:48:00 +0200 Subject: [PATCH] plugin: Always make sure we have Gdk display Give up creating GL context in an unlikely situation that there is no default display --- lib/gst/plugin/importers/gstclapperglbaseimporter.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/gst/plugin/importers/gstclapperglbaseimporter.c b/lib/gst/plugin/importers/gstclapperglbaseimporter.c index 207fe0ce..cb558030 100644 --- a/lib/gst/plugin/importers/gstclapperglbaseimporter.c +++ b/lib/gst/plugin/importers/gstclapperglbaseimporter.c @@ -109,6 +109,11 @@ retrieve_gl_context_on_main (GstClapperGLBaseImporter *self) gdk_display = gdk_display_get_default (); + if (G_UNLIKELY (!gdk_display)) { + GST_ERROR_OBJECT (self, "Could not retrieve Gdk display"); + return FALSE; + } + if (!(gdk_context = gdk_display_create_gl_context (gdk_display, &error))) { GST_ERROR_OBJECT (self, "Error creating Gdk GL context: %s", error ? error->message : "No error set by Gdk");