[maemo-commits] [maemo-commits] r17813 - in projects/haf/trunk/libmatchbox2: . matchbox/core

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Mar 26 18:08:24 EET 2009
Author: kihamala
Date: 2009-03-26 18:08:22 +0200 (Thu, 26 Mar 2009)
New Revision: 17813

Modified:
   projects/haf/trunk/libmatchbox2/ChangeLog
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-object.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-object.h
Log:
fix another crash


Modified: projects/haf/trunk/libmatchbox2/ChangeLog
===================================================================
--- projects/haf/trunk/libmatchbox2/ChangeLog	2009-03-26 15:56:11 UTC (rev 17812)
+++ projects/haf/trunk/libmatchbox2/ChangeLog	2009-03-26 16:08:22 UTC (rev 17813)
@@ -1,3 +1,13 @@
+2009-03-26  Kimmo Hämäläinen  <kimmo.hamalainen at nokia.com>
+
+	Fix crash of NB#104271
+
+	* matchbox/core/mb-window-manager.c (mb_wm_handle_hang_client):
+	Reference the client for the case that it is unreffed while we are in
+	the hang client handler. When returning from the handler, check if the
+	client was unreffed (unmapped) before trying shut it down.
+	* matchbox/core/mb-wm-object.[ch] (mb_wm_object_get_refcount): New.
+
 2009-03-26  Thomas Thurman  <thomas.thurman at collabora.co.uk>
 
 	* matchbox/core/mb-wm-main-context.c: apparently sometimes someone

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c	2009-03-26 15:56:11 UTC (rev 17812)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c	2009-03-26 16:08:22 UTC (rev 17813)
@@ -1914,14 +1914,19 @@
 
   wm_klass = MB_WINDOW_MANAGER_CLASS (MB_WM_OBJECT_GET_CLASS (wm));
 
+  /* reference it in case it gets unreffed in the hang handlers */
+  mb_wm_object_ref (MB_WM_OBJECT (c));
   if (!wm_klass->client_hang || !wm_klass->client_hang (wm, c))
     {
-      mb_wm_client_shutdown (c);
+      /* if this client is still managed/mapped, refcount is > 1 */
+      if (mb_wm_object_get_refcount (MB_WM_OBJECT (c)) > 1)
+        mb_wm_client_shutdown (c);
     }
 
   if (mb_wm_client_ping_in_progress (c))
     /* hung client is now handled, no need for ping process */
     mb_wm_client_ping_stop (c);
+  mb_wm_object_unref (MB_WM_OBJECT (c));
 }
 
 void

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-object.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-object.c	2009-03-26 15:56:11 UTC (rev 17812)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-object.c	2009-03-26 16:08:22 UTC (rev 17813)
@@ -188,6 +188,12 @@
     mb_wm_object_destroy_recursive (parent_klass, this);
 }
 
+int
+mb_wm_object_get_refcount (MBWMObject *this)
+{
+  return this->refcnt;
+}
+
 void
 mb_wm_object_unref (MBWMObject *this)
 {

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-object.h
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-object.h	2009-03-26 15:56:11 UTC (rev 17812)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-object.h	2009-03-26 16:08:22 UTC (rev 17813)
@@ -112,6 +112,9 @@
 void
 mb_wm_object_unref (MBWMObject *this);
 
+int
+mb_wm_object_get_refcount (MBWMObject *this);
+
 MBWMObject*
 mb_wm_object_new (int type, ...);
 


More information about the maemo-commits mailing list