[maemo-commits] [maemo-commits] r11487 - in projects/haf/trunk/hildon-desktop: . libhildondesktop

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon May 7 14:49:12 EEST 2007
Author: jobi
Date: 2007-05-07 14:49:10 +0300 (Mon, 07 May 2007)
New Revision: 11487

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-window-dialog.c
Log:

2007-05-07  Johan Bilien  <johan.bilien at nokia.com>

	* libhildondesktop/hildon-desktop-panel-window-dialog.c:
	- add gdk_error_trap_ around XGetWindowProperty
	- do not crash if the property is not set



Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-05-07 11:45:28 UTC (rev 11486)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-05-07 11:49:10 UTC (rev 11487)
@@ -1,3 +1,9 @@
+2007-05-07  Johan Bilien  <johan.bilien at nokia.com>
+
+	* libhildondesktop/hildon-desktop-panel-window-dialog.c:
+	- add gdk_error_trap_ around XGetWindowProperty
+	- do not crash if the property is not set
+
 2007-05-07  Lucas Rocha  <lucas.rocha at nokia.com>
 
 	* src/hd-desktop.c: watch notification with system.note.infoprint and

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-window-dialog.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-window-dialog.c	2007-05-07 11:45:28 UTC (rev 11486)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-window-dialog.c	2007-05-07 11:49:10 UTC (rev 11487)
@@ -127,6 +127,7 @@
 
   atom_check = XInternAtom (dpy, "_NET_SUPPORTING_WM_CHECK", False);
 
+  gdk_error_trap_push ();
   XGetWindowProperty (dpy, 
 		      GDK_WINDOW_XID (gdk_get_default_root_window ()),
 		      atom_check,
@@ -139,16 +140,21 @@
   atom_utf8_string = XInternAtom (dpy, "UTF8_STRING", False);
   atom_wm_name     = XInternAtom (dpy, "_NET_WM_NAME", False);
 
+  gdk_error_trap_push ();
   result = XGetWindowProperty (dpy, *(support_xwin.w), atom_wm_name,
 			       0, 1000L,False, atom_utf8_string,
 			       &type, &format, &nitems,
 			       &bytes_after, &val);
+
+  if (gdk_error_trap_pop ())
+      return NULL;
+
   if (result != Success)
     return NULL;
 
   if (type != atom_utf8_string || format !=8 || nitems == 0)
   {
-    if (val) 
+    if (val)
       XFree (val);
     return NULL;
   }
@@ -217,7 +223,7 @@
 
   wm_name = hildon_desktop_get_current_wm_name (window);
 
-  if (g_str_equal (wm_name, "matchbox"))
+  if (wm_name && g_str_equal (wm_name, "matchbox"))
   {
     if (window->priv->old_titlebar)
     {


More information about the maemo-commits mailing list