From f85afa9f7d1b43d9eb56a5c8cb4011f3d2521306 Mon Sep 17 00:00:00 2001 From: Kjartan Maraas Date: Thu, 1 Mar 2007 12:49:15 +0000 Subject: Workaround for crash in bug #330728. Patch from Caolan McNamara. 2007-03-01 Kjartan Maraas * e-table/gal-a11y-e-cell-tree.c: (kill_view_cb), (ectr_subcell_weak_ref), (gal_a11y_e_cell_tree_new): Workaround for crash in bug #330728. Patch from Caolan McNamara. svn path=/trunk/; revision=33268 --- a11y/ChangeLog | 7 +++++++ a11y/e-table/gal-a11y-e-cell-tree.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) (limited to 'a11y') diff --git a/a11y/ChangeLog b/a11y/ChangeLog index 66ab17d866..44f8dab51c 100644 --- a/a11y/ChangeLog +++ b/a11y/ChangeLog @@ -1,3 +1,10 @@ +2007-03-01 Kjartan Maraas + + * e-table/gal-a11y-e-cell-tree.c: (kill_view_cb), + (ectr_subcell_weak_ref), (gal_a11y_e_cell_tree_new): + Workaround for crash in bug #330728. Patch from + Caolan McNamara. + 2007-01-24 Wang Xin * e-text/gal-a11y-e-text.c: Fixes #400121. diff --git a/a11y/e-table/gal-a11y-e-cell-tree.c b/a11y/e-table/gal-a11y-e-cell-tree.c index 068658cafa..b86ecc01bd 100644 --- a/a11y/e-table/gal-a11y-e-cell-tree.c +++ b/a11y/e-table/gal-a11y-e-cell-tree.c @@ -49,10 +49,31 @@ ectr_model_row_changed_cb (ETableModel *etm, } } +static void +kill_view_cb(ECellView *subcell_view, + GList *subcell_a11ies) +{ + GList *node; + GalA11yECell *subcell; + for (node = subcell_a11ies; node != NULL; node = g_list_next (node)) + { + subcell = GAL_A11Y_E_CELL(node->data); + if (subcell && subcell->cell_view == subcell_view) + { + fprintf(stderr, "subcell_view %p deleted before the a11y object %p\n", subcell_view, subcell); + subcell->cell_view = NULL; + } + } +} + static void ectr_subcell_weak_ref (GalA11yECellTree *a11y, GalA11yECell *subcell_a11y) { + ECellView *subcell_view = subcell_a11y ? subcell_a11y->cell_view : 0; + if (subcell_a11y && subcell_view && subcell_view->kill_view_cb_data) + g_list_remove(subcell_view->kill_view_cb_data, subcell_a11y); + g_signal_handler_disconnect (GAL_A11Y_E_CELL (a11y)->item->table_model, a11y->model_row_changed_id); g_object_unref (a11y); @@ -207,6 +228,14 @@ gal_a11y_e_cell_tree_new (ETableItem *item, g_signal_connect (item->table_model, "model_row_changed", G_CALLBACK (ectr_model_row_changed_cb), subcell_a11y); + + if (subcell_a11y && subcell_view) + { + subcell_view->kill_view_cb = kill_view_cb; + if (!g_list_find(subcell_view->kill_view_cb_data, subcell_a11y)) + subcell_view->kill_view_cb_data = g_list_append(subcell_view->kill_view_cb_data, subcell_a11y); + } + g_object_weak_ref (G_OBJECT (subcell_a11y), (GWeakNotify) ectr_subcell_weak_ref, a11y); return subcell_a11y; -- cgit v1.2.3