Mailing List Archive

r19286 - in projects/haf/trunk/libmatchbox2: . matchbox/core
Author: kihamala
Date: 2009-09-02 17:29:25 +0300 (Wed, 02 Sep 2009)
New Revision: 19286

Modified:
projects/haf/trunk/libmatchbox2/ChangeLog
projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-decor.c
Log:

* matchbox/core/mb-wm-decor.c (mb_wm_decor_button_press_handler):
While we are in the loop processing other X events, keep a reference
for the parent client to avoid crash when the client is unreferenced
while the button is pressed (e.g. long press). Make sure that the
'transients' list is freed and the button is unreferenced every time.



Modified: projects/haf/trunk/libmatchbox2/ChangeLog
===================================================================
--- projects/haf/trunk/libmatchbox2/ChangeLog 2009-09-01 16:06:12 UTC (rev 19285)
+++ projects/haf/trunk/libmatchbox2/ChangeLog 2009-09-02 14:29:25 UTC (rev 19286)
@@ -1,3 +1,11 @@
+2009-09-02 Kimmo Hämäläinen <kimmo.hamalainen@nokia.com>
+
+ * matchbox/core/mb-wm-decor.c (mb_wm_decor_button_press_handler):
+ While we are in the loop processing other X events, keep a reference
+ for the parent client to avoid crash when the client is unreferenced
+ while the button is pressed (e.g. long press). Make sure that the
+ 'transients' list is freed and the button is unreferenced every time.
+
2009-09-01 Kimmo Hämäläinen <kimmo.hamalainen@nokia.com>

Release 0.2.62

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-decor.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-decor.c 2009-09-01 16:06:12 UTC (rev 19285)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-decor.c 2009-09-02 14:29:25 UTC (rev 19286)
@@ -790,6 +790,7 @@
MBWindowManager *wm;
MBWMList *transients = NULL;
Bool retval = True;
+ Bool unref_parent_client = False;

if (!button->realized || !decor || !decor->parent_client)
return False;
@@ -900,6 +901,11 @@
mb_wm_theme_paint_button (wm->theme, button);
}

+ /* reference the client for the loop, since it could be
+ * unreffed while we are handling events there */
+ mb_wm_object_ref (MB_WM_OBJECT(decor->parent_client));
+ unref_parent_client = True;
+
for (;;)
{
/*
@@ -921,8 +927,8 @@
wm->main_ctx, ButtonRelease,
decor->release_cb_id);
decor->release_cb_id = 0;
- mb_wm_object_unref (MB_WM_OBJECT(button));
- return False;
+ retval = False;
+ goto done;
}

if (!decor->release_cb_id)
@@ -933,7 +939,8 @@
button->state = MBWMDecorButtonStateInactive;
mb_wm_theme_paint_button (wm->theme, button);
}
- return False;
+ retval = False;
+ goto done;
}

if (XCheckMaskEvent(wm->xdpy,
@@ -1014,8 +1021,8 @@
else
mb_wm_decor_button_stock_button_action (button);

- mb_wm_object_unref (MB_WM_OBJECT(button));
- return False;
+ retval = False;
+ goto done;
}
}
}
@@ -1039,6 +1046,8 @@
done:
mb_wm_util_list_free (transients);
mb_wm_object_unref (MB_WM_OBJECT(button));
+ if (unref_parent_client)
+ mb_wm_object_unref (MB_WM_OBJECT(decor->parent_client));
return retval;
}


_______________________________________________
maemo-commits mailing list
maemo-commits@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-commits