[maemo-commits] [maemo-commits] r9707 - in projects/haf/branches/hildon-libs/hildon-1: . src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Feb 7 14:15:25 EET 2007
Author: mdk
Date: 2007-02-07 14:15:24 +0200 (Wed, 07 Feb 2007)
New Revision: 9707

Modified:
   projects/haf/branches/hildon-libs/hildon-1/ChangeLog.2
   projects/haf/branches/hildon-libs/hildon-1/src/hildon-program.c
   projects/haf/branches/hildon-libs/hildon-1/src/hildon-window.c
Log:
Trap the X error in HildonWindow instead of aborting.


Modified: projects/haf/branches/hildon-libs/hildon-1/ChangeLog.2
===================================================================
--- projects/haf/branches/hildon-libs/hildon-1/ChangeLog.2	2007-02-07 11:52:35 UTC (rev 9706)
+++ projects/haf/branches/hildon-libs/hildon-1/ChangeLog.2	2007-02-07 12:15:24 UTC (rev 9707)
@@ -1,5 +1,11 @@
 2007-02-07  Michael Dominic Kostrzewa  <michael.kostrzewa at nokia.com> 
 
+	* src/hildon-program.c:
+	* src/hildon-window.c: Trap the X error instead of aborting. A patch
+	by Johan Bilien, fixes MB#900.
+
+2007-02-07  Michael Dominic Kostrzewa  <michael.kostrzewa at nokia.com> 
+
 	* src/hildon-number-editor.c:
 	* src/hildon-number-editor.h: Prefixing the number editor enums with
 	HILDON_NUMBER_EDITOR_ERROR_. Not sure why I haven't really noticed

Modified: projects/haf/branches/hildon-libs/hildon-1/src/hildon-program.c
===================================================================
--- projects/haf/branches/hildon-libs/hildon-1/src/hildon-program.c	2007-02-07 11:52:35 UTC (rev 9706)
+++ projects/haf/branches/hildon-libs/hildon-1/src/hildon-program.c	2007-02-07 12:15:24 UTC (rev 9707)
@@ -304,7 +304,13 @@
 
     if (active_window)
     {
+      gint xerror;
+      
+      gdk_error_trap_push ();
       wm_hints = XGetWMHints (GDK_DISPLAY (), active_window);
+      xerror = gdk_error_trap_pop ();
+      if (xerror)
+        return;
 
       if (wm_hints)
       {

Modified: projects/haf/branches/hildon-libs/hildon-1/src/hildon-window.c
===================================================================
--- projects/haf/branches/hildon-libs/hildon-1/src/hildon-window.c	2007-02-07 11:52:35 UTC (rev 9706)
+++ projects/haf/branches/hildon-libs/hildon-1/src/hildon-window.c	2007-02-07 12:15:24 UTC (rev 9707)
@@ -1002,6 +1002,7 @@
 hildon_window_get_active_window                 (void)
 {
     Atom realtype;
+    gint xerror;
     int format;
     int status;
     Window ret;
@@ -1017,11 +1018,13 @@
 
     win.win = NULL;
 
+    gdk_error_trap_push ();
     status = XGetWindowProperty (GDK_DISPLAY(), GDK_ROOT_WINDOW(),
             active_app_atom, 0L, 16L,
             0, XA_WINDOW, &realtype, &format,
             &n, &extra, &win.char_pointer);
-    if (!(status == Success && realtype == XA_WINDOW && format == 32
+    xerror = gdk_error_trap_pop ();
+    if (xerror || !(status == Success && realtype == XA_WINDOW && format == 32
                 && n == 1 && win.win != NULL))
     {
         if (win.win != NULL)


More information about the maemo-commits mailing list