Skip to content

Commit

Permalink
Don't run gdk_x11_* functions unless running on X11
Browse files Browse the repository at this point in the history
GDK on Linux can be compiled with multiple backends,
so it is not enough to add build time checks for
backend support, but also runtime checks.
  • Loading branch information
elkrejzi authored and Jonathan Matthew committed Mar 8, 2014
1 parent f4b18d4 commit d97dcd0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 5 additions & 3 deletions lib/rb-missing-plugins.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,11 @@ rb_missing_plugins_install (const char **details, gboolean ignore_blacklist, GCl

if (parent_window != NULL && gtk_widget_get_realized (GTK_WIDGET (parent_window))) {
#ifdef GDK_WINDOWING_X11
gulong xid = 0;
xid = gdk_x11_window_get_xid (gtk_widget_get_window (GTK_WIDGET (parent_window)));
gst_install_plugins_context_set_xid (install_ctx, xid);
if (GDK_IS_X11_WINDOW (gtk_widget_get_window (GTK_WIDGET (parent_window)))) {
gulong xid = 0;
xid = gdk_x11_window_get_xid (gtk_widget_get_window (GTK_WIDGET (parent_window)));
gst_install_plugins_context_set_xid (install_ctx, xid);
}
#endif
}

Expand Down
8 changes: 4 additions & 4 deletions plugins/brasero-disc-recorder/rb-disc-recorder-plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
#include <glib.h>
#include <glib-object.h>
#include <glib/gstdio.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif
#include <brasero-media.h>
#include <brasero-medium-monitor.h>

Expand Down Expand Up @@ -127,7 +129,7 @@ rb_disc_recorder_plugin_start_burning (RBDiscRecorderPlugin *pi,
GtkWidget *main_window;
GdkWindow *window;
GPtrArray *array;
char **args, *xid_str;
char **args, *xid_str = NULL;
GError *error = NULL;
gboolean ret;
RBShell *shell;
Expand All @@ -145,14 +147,12 @@ rb_disc_recorder_plugin_start_burning (RBDiscRecorderPlugin *pi,
g_object_unref (shell);

window = gtk_widget_get_window (main_window);
if (window) {
if (window && GDK_IS_X11_WINDOW (window)) {
int xid;
xid = gdk_x11_window_get_xid (window);
xid_str = g_strdup_printf ("%d", xid);
g_ptr_array_add (array, "-x");
g_ptr_array_add (array, xid_str);
} else {
xid_str = NULL;
}

g_ptr_array_add (array, NULL);
Expand Down

0 comments on commit d97dcd0

Please sign in to comment.