[maemo-commits] [maemo-commits] r19091 - in projects/haf/trunk/libmatchbox2: . matchbox/core
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Mon Aug 10 15:00:24 EEST 2009
- Previous message: [maemo-commits] r19090 - projects/haf/trunk/hildon-control-panel/debian
- Next message: [maemo-commits] r19092 - in projects/haf/trunk/libmatchbox2: . debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: kihamala Date: 2009-08-10 15:00:17 +0300 (Mon, 10 Aug 2009) New Revision: 19091 Modified: projects/haf/trunk/libmatchbox2/ChangeLog projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-decor.c projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.c projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.h projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-types.h Log: Patch from Laszlo Pere for NB#117853. * matchbox/core/mb-wm-main-context.[ch] (mb_wm_main_context_x_event_handler_remove): Do not modify the linked list but merely mark the list element as deleted. (mb_wm_main_context_handle_x_event): After calling all event handlers, remove event handlers that have been marked as deleted. * matchbox/core/mb-wm-decor.c (mb_wm_decor_button_destroy): Move removal of the XEvent handler back to mb_wm_decor_button_unrealize. Now it should be safe. Modified: projects/haf/trunk/libmatchbox2/ChangeLog =================================================================== --- projects/haf/trunk/libmatchbox2/ChangeLog 2009-08-07 11:35:33 UTC (rev 19090) +++ projects/haf/trunk/libmatchbox2/ChangeLog 2009-08-10 12:00:17 UTC (rev 19091) @@ -1,3 +1,16 @@ +2009-08-10 Kimmo Hämäläinen <kimmo.hamalainen at nokia.com> + + Patch from Laszlo Pere for NB#117853. + + * matchbox/core/mb-wm-main-context.[ch] + (mb_wm_main_context_x_event_handler_remove): Do not modify the linked + list but merely mark the list element as deleted. + (mb_wm_main_context_handle_x_event): After calling all event handlers, + remove event handlers that have been marked as deleted. + * matchbox/core/mb-wm-decor.c (mb_wm_decor_button_destroy): Move + removal of the XEvent handler back to mb_wm_decor_button_unrealize. + Now it should be safe. + 2009-08-07 Kimmo Hämäläinen <kimmo.hamalainen at nokia.com> Release 0.2.54 Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-decor.c =================================================================== --- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-decor.c 2009-08-07 11:35:33 UTC (rev 19090) +++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-decor.c 2009-08-10 12:00:17 UTC (rev 19091) @@ -1157,23 +1157,7 @@ mb_wm_decor_button_destroy (MBWMObject* obj) { MBWMDecorButton * button = MB_WM_DECOR_BUTTON (obj); - MBWMMainContext * ctx = NULL; - - ctx = button && - button->decor && - button->decor->parent_client && - button->decor->parent_client->wmref ? - button->decor->parent_client->wmref->main_ctx : NULL; - if (!ctx) - return; - /* - * We are doing the job in the mb_wm_decor_button_unrealize() while the - * decoration still exists. - */ - mb_wm_main_context_x_event_handler_remove (ctx, ButtonPress, - button->press_cb_id); - if (button->userdata && button->destroy_userdata) button->destroy_userdata (button, button->userdata); @@ -1206,7 +1190,25 @@ static void mb_wm_decor_button_unrealize (MBWMDecorButton *button) { - button->realized = False; + MBWMMainContext *ctx; + + if (button) + button->realized = False; + + ctx = button && + button->decor && + button->decor->parent_client && + button->decor->parent_client->wmref ? + button->decor->parent_client->wmref->main_ctx : NULL; + + if (!ctx) + return; + /* + * We are doing the job in the mb_wm_decor_button_unrealize() while the + * decoration still exists. + */ + mb_wm_main_context_x_event_handler_remove (ctx, ButtonPress, + button->press_cb_id); } static void Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.c =================================================================== --- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.c 2009-08-07 11:35:33 UTC (rev 19090) +++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.c 2009-08-10 12:00:17 UTC (rev 19091) @@ -64,6 +64,12 @@ static Bool mb_wm_main_context_spin_xevent (MBWMMainContext *ctx); +static void +mb_wm_list_remove_deleted_handlers (MBWMList **l_start); + +static void +mb_wm_main_context_remove_deleted_handlers (MBWMMainContext *ctx); + struct MBWMTimeOutEventInfo { int ms; @@ -180,7 +186,8 @@ MBWMXEventFuncInfo *i = iter->data; MBWMList *next = iter->next; - if (i && (i->xwindow == None || i->xwindow == xwin)) + if (i && !i->deleted && + (i->xwindow == None || i->xwindow == xwin)) { if (!i->func (event, i->userdata)) { @@ -362,6 +369,8 @@ break; } + mb_wm_main_context_remove_deleted_handlers (ctx); + return False; } @@ -460,6 +469,7 @@ func_info->xwindow = xwin; func_info->userdata = userdata; func_info->id = ids; + func_info->deleted = False; #if ENABLE_COMPOSITE if (type == wm->damage_event_base + XDamageNotify) @@ -535,6 +545,133 @@ return ids; } +static void +mb_wm_list_remove_deleted_handlers (MBWMList **l_start) +{ + MBWMList * l = NULL; + + if (l_start) + l = *l_start; + + while (l) + { + MBWMXEventFuncInfo * info = l->data; + + if (info->deleted) + { + MBWMList * prev = l->prev; + MBWMList * next = l->next; + + g_warning ("%s: Deleting list item at %p", __func__, l); + if (prev) + prev->next = next; + else + *l_start = next; + + if (next) + next->prev = prev; + + memset (info, 0, sizeof(*info)); + free (info); + free (l); + + l = next; + } else { + l = l->next; + } + } +} + +static void +mb_wm_main_context_remove_deleted_handlers (MBWMMainContext *ctx) +{ + if (ctx->event_funcs.deleted_map_notify) + { + mb_wm_list_remove_deleted_handlers (&ctx->event_funcs.map_notify); + ctx->event_funcs.deleted_map_notify = False; + } + + if (ctx->event_funcs.deleted_unmap_notify) + { + mb_wm_list_remove_deleted_handlers (&ctx->event_funcs.unmap_notify); + ctx->event_funcs.deleted_unmap_notify = False; + } + + if (ctx->event_funcs.deleted_map_request) + { + mb_wm_list_remove_deleted_handlers (&ctx->event_funcs.map_request); + ctx->event_funcs.deleted_map_request = False; + } + + if (ctx->event_funcs.deleted_destroy_notify) + { + mb_wm_list_remove_deleted_handlers (&ctx->event_funcs.destroy_notify); + ctx->event_funcs.deleted_destroy_notify = False; + } + + if (ctx->event_funcs.deleted_configure_request) + { + mb_wm_list_remove_deleted_handlers (&ctx->event_funcs.configure_request); + ctx->event_funcs.deleted_configure_request = False; + } + + if (ctx->event_funcs.deleted_configure_notify) + { + mb_wm_list_remove_deleted_handlers (&ctx->event_funcs.configure_notify); + ctx->event_funcs.deleted_configure_notify = False; + } + + if (ctx->event_funcs.deleted_key_press) + { + mb_wm_list_remove_deleted_handlers (&ctx->event_funcs.key_press); + ctx->event_funcs.deleted_key_press = False; + } + + if (ctx->event_funcs.deleted_key_release) + { + mb_wm_list_remove_deleted_handlers (&ctx->event_funcs.key_release); + ctx->event_funcs.deleted_key_release = False; + } + + if (ctx->event_funcs.deleted_property_notify) + { + mb_wm_list_remove_deleted_handlers (&ctx->event_funcs.property_notify); + ctx->event_funcs.deleted_property_notify = False; + } + + if (ctx->event_funcs.deleted_button_press) + { + mb_wm_list_remove_deleted_handlers (&ctx->event_funcs.button_press); + ctx->event_funcs.deleted_button_press = False; + } + + if (ctx->event_funcs.deleted_button_release) + { + mb_wm_list_remove_deleted_handlers (&ctx->event_funcs.button_release); + ctx->event_funcs.deleted_button_release = False; + } + + if (ctx->event_funcs.deleted_motion_notify) + { + mb_wm_list_remove_deleted_handlers (&ctx->event_funcs.motion_notify); + ctx->event_funcs.deleted_motion_notify = False; + } + + if (ctx->event_funcs.deleted_client_message) + { + mb_wm_list_remove_deleted_handlers (&ctx->event_funcs.client_message); + ctx->event_funcs.deleted_client_message = False; + } + +#if ENABLE_COMPOSITE + if (ctx->event_funcs.deleted_damage_notify) + { + mb_wm_list_remove_deleted_handlers (&ctx->event_funcs.damage_notify); + ctx->event_funcs.deleted_damage_notify = False; + } +#endif +} + void mb_wm_main_context_x_event_handler_remove (MBWMMainContext *ctx, int type, @@ -557,42 +694,55 @@ case Expose: break; case MapRequest: + ctx->event_funcs.deleted_map_request = True; l_start = &ctx->event_funcs.map_request; break; case MapNotify: + ctx->event_funcs.deleted_map_notify = True; l_start = &ctx->event_funcs.map_notify; break; case UnmapNotify: + ctx->event_funcs.deleted_unmap_notify = True; l_start = &ctx->event_funcs.unmap_notify; break; case DestroyNotify: + ctx->event_funcs.deleted_destroy_notify = True; l_start = &ctx->event_funcs.destroy_notify; break; case ConfigureNotify: + ctx->event_funcs.deleted_configure_notify = True; l_start = &ctx->event_funcs.configure_notify; break; case ConfigureRequest: + ctx->event_funcs.deleted_configure_request = True; l_start = &ctx->event_funcs.configure_request; break; case KeyPress: + ctx->event_funcs.deleted_key_press = True; l_start = &ctx->event_funcs.key_press; break; case KeyRelease: + ctx->event_funcs.deleted_key_release = True; l_start = &ctx->event_funcs.key_release; break; case PropertyNotify: + ctx->event_funcs.deleted_property_notify = True; l_start = &ctx->event_funcs.property_notify; break; case ButtonPress: + ctx->event_funcs.deleted_button_press = True; l_start = &ctx->event_funcs.button_press; break; case ButtonRelease: + ctx->event_funcs.deleted_button_release = True; l_start = &ctx->event_funcs.button_release; break; case MotionNotify: + ctx->event_funcs.deleted_motion_notify = True; l_start = &ctx->event_funcs.motion_notify; break; case ClientMessage: + ctx->event_funcs.deleted_client_message = True; l_start = &ctx->event_funcs.client_message; break; @@ -609,21 +759,7 @@ if (info->id == id) { - MBWMList * prev = l->prev; - MBWMList * next = l->next; - - if (prev) - prev->next = next; - else - *l_start = next; - - if (next) - next->prev = prev; - - memset (info, 0, sizeof(*info)); - free (info); - free (l); - + info->deleted = True; return; } Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.h =================================================================== --- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.h 2009-08-07 11:35:33 UTC (rev 19090) +++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.h 2009-08-10 12:00:17 UTC (rev 19091) @@ -39,21 +39,35 @@ { /* FIXME: figure our X wrap / unwrap mechanism */ MBWMList *map_notify; + Bool deleted_map_notify; MBWMList *unmap_notify; + Bool deleted_unmap_notify; MBWMList *map_request; + Bool deleted_map_request; MBWMList *destroy_notify; + Bool deleted_destroy_notify; MBWMList *configure_request; + Bool deleted_configure_request; MBWMList *configure_notify; + Bool deleted_configure_notify; MBWMList *key_press; + Bool deleted_key_press; MBWMList *key_release; + Bool deleted_key_release; MBWMList *property_notify; + Bool deleted_property_notify; MBWMList *button_press; + Bool deleted_button_press; MBWMList *button_release; + Bool deleted_button_release; MBWMList *motion_notify; + Bool deleted_motion_notify; MBWMList *client_message; + Bool deleted_client_message; #if ENABLE_COMPOSITE MBWMList *damage_notify; + Bool deleted_damage_notify; #endif #if ! USE_GLIB_MAINLOOP Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-types.h =================================================================== --- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-types.h 2009-08-07 11:35:33 UTC (rev 19090) +++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-types.h 2009-08-10 12:00:17 UTC (rev 19091) @@ -432,6 +432,7 @@ Window xwindow; void *userdata; unsigned long id; + Bool deleted; } MBWMXEventFuncInfo;
- Previous message: [maemo-commits] r19090 - projects/haf/trunk/hildon-control-panel/debian
- Next message: [maemo-commits] r19092 - in projects/haf/trunk/libmatchbox2: . debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]