[gtk+] Don't crash if inhibit is called with an unrealized window
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Don't crash if inhibit is called with an unrealized window
- Date: Fri, 15 Feb 2013 21:56:43 +0000 (UTC)
commit 8e96488bb29dc51315680d3745f945be19a03fc1
Author: William Jon McCann <jmccann redhat com>
Date: Fri Feb 15 16:21:09 2013 -0500
Don't crash if inhibit is called with an unrealized window
gtk/gtkapplication.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkapplication.c b/gtk/gtkapplication.c
index bbb65b8..9072907 100644
--- a/gtk/gtkapplication.c
+++ b/gtk/gtkapplication.c
@@ -1418,16 +1418,22 @@ gtk_application_inhibit (GtkApplication *application,
GVariant *res;
GError *error = NULL;
guint cookie;
- guint xid;
+ guint xid = 0;
g_return_val_if_fail (GTK_IS_APPLICATION (application), 0);
g_return_val_if_fail (!g_application_get_is_remote (G_APPLICATION (application)), 0);
g_return_val_if_fail (application->priv->sm_proxy != NULL, 0);
if (window != NULL)
- xid = GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (window)));
- else
- xid = 0;
+ {
+ GdkWindow *gdkwindow;
+
+ gdkwindow = gtk_widget_get_window (GTK_WIDGET (window));
+ if (gdkwindow == NULL)
+ g_warning ("Inhibit called with an unrealized window");
+ else
+ xid = GDK_WINDOW_XID (gdkwindow);
+ }
res = g_dbus_proxy_call_sync (application->priv->sm_proxy,
"Inhibit",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]