summaryrefslogtreecommitdiff
path: root/fix-gtk-show-uri-crash.patch
blob: 928e268b26b7bc3bf214484e06aa02029fb026b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From 7e29fc5b421a049c2b88453232eddeefed9f1b7b Mon Sep 17 00:00:00 2001
From: Cosimo Cecchi <cosimoc@gnome.org>
Date: Thu, 13 Jan 2011 15:03:49 +0000
Subject: gtkshow: don't call _get_display() on a NULL GdkScreen

gtk_show_uri() is documented to accept a NULL screen to mean the default
one. Calling gdk_screen_get_display() on a NULL object will cause
segfaults.
---
diff --git a/gtk/gtkshow.c b/gtk/gtkshow.c
index ac3d1ac..ad396a2 100644
--- a/gtk/gtkshow.c
+++ b/gtk/gtkshow.c
@@ -63,10 +63,16 @@ gtk_show_uri (GdkScreen    *screen,
 {
   GdkAppLaunchContext *context;
   gboolean ret;
+  GdkDisplay *display;
 
   g_return_val_if_fail (uri != NULL, FALSE);
 
-  context = gdk_display_get_app_launch_context (gdk_screen_get_display (screen));
+  if (screen != NULL)
+    display = gdk_screen_get_display (screen);
+  else
+    display = gdk_display_get_default ();
+
+  context = gdk_display_get_app_launch_context (display);
   gdk_app_launch_context_set_screen (context, screen);
   gdk_app_launch_context_set_timestamp (context, timestamp);
 
--
cgit v0.8.3.1
bgstack15