summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alla@lysator.liu.se>2002-04-21 22:15:03 +0000
committerAlexander Larsson <alexl@src.gnome.org>2002-04-21 22:15:03 +0000
commitd85445803046ed8e17a058decf666bacfc61ef84 (patch)
tree3de6593bc9f6f4491b573306ccd0c85377ec8ebf
parent84b62cbdd10219110ca31c876e4c019e5352bf9b (diff)
downloadnautilus-d85445803046ed8e17a058decf666bacfc61ef84.tar.gz
Check the return value of XOpenDisplay and handle failures.
2002-04-21 Alexander Larsson <alla@lysator.liu.se> * libnautilus-private/nautilus-directory-background.c (image_loading_done_callback), (make_root_pixmap): Check the return value of XOpenDisplay and handle failures.
-rw-r--r--ChangeLog7
-rw-r--r--libnautilus-private/nautilus-directory-background.c14
2 files changed, 20 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 0958b992a..3da908ef6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2002-04-21 Alexander Larsson <alla@lysator.liu.se>
+ * libnautilus-private/nautilus-directory-background.c
+ (image_loading_done_callback), (make_root_pixmap):
+ Check the return value of XOpenDisplay and handle
+ failures.
+
+2002-04-21 Alexander Larsson <alla@lysator.liu.se>
+
* src/nautilus-desktop-window.c (nautilus_desktop_window_class_init):
Disable the whole flash-workaround hack since it doesn't work
and is causing crashes on solaris.
diff --git a/libnautilus-private/nautilus-directory-background.c b/libnautilus-private/nautilus-directory-background.c
index fd72dee99..71337a9c9 100644
--- a/libnautilus-private/nautilus-directory-background.c
+++ b/libnautilus-private/nautilus-directory-background.c
@@ -475,11 +475,19 @@ static GdkPixmap *
make_root_pixmap (gint width, gint height)
{
Display *display;
+ char *display_name;
Pixmap result;
gdk_flush ();
- display = XOpenDisplay (DisplayString (GDK_DISPLAY ()));
+ display_name = DisplayString (GDK_DISPLAY ());
+ display = XOpenDisplay (display_name);
+
+ if (display == NULL) {
+ g_warning ("Unable to open display '%s' when setting background pixmap\n",
+ (display_name) ? display_name : "NULL");
+ return NULL;
+ }
XSetCloseDownMode (display, RetainPermanent);
@@ -570,6 +578,10 @@ image_loading_done_callback (EelBackground *background, gboolean successful_load
height = gdk_screen_height ();
pixmap = make_root_pixmap (width, height);
+ if (pixmap == NULL) {
+ return;
+ }
+
gc = gdk_gc_new (pixmap);
eel_background_draw_to_drawable (background, pixmap, gc, 0, 0, width, height, width, height);
g_object_unref (gc);