Hi Mike, another patch for gal accessibility. bug # 51139: evolution crash on exit in gal-a11y-e-table-item when work with at-poke http://bugzilla.ximian.com/show_bug.cgi?id=51139 Thanks, Bolian Yin |
Index: ChangeLog =================================================================== RCS file: /cvs/gnome/gal/ChangeLog,v retrieving revision 1.824 diff -u -r1.824 ChangeLog --- ChangeLog 17 Nov 2003 21:05:13 -0000 1.824 +++ ChangeLog 19 Nov 2003 04:12:14 -0000 @@ -1,3 +1,10 @@ +2003-11-19 Bolian Yin <bolian yin sun com> + + Fixes #51139 + + * gal/a11y/gal-a11y-e-table-item: (gal_a11y_e_table_item_ref_selection) + (gal_a11y_e_table_item_unref_selection): new functions. + 2003-11-17 Mike Kestner <mkestner ximian com> * gal/widgets/gtk-combo* : renamespace and move to Index: gal/e-table/ChangeLog =================================================================== RCS file: /cvs/gnome/gal/gal/e-table/ChangeLog,v retrieving revision 1.920 diff -u -r1.920 ChangeLog --- gal/e-table/ChangeLog 17 Nov 2003 21:05:14 -0000 1.920 +++ gal/e-table/ChangeLog 19 Nov 2003 04:12:20 -0000 @@ -1,3 +1,9 @@ +2003-11-19 Bolian Yin <bolian yin sun com> + + Fixes #51139 + + * e-table-item.c : change the place of emitting ""selection_model_removed" signal. + 2003-11-17 Mike Kestner <mkestner ximian com> * e-table-config.c : use new gal_combo_* namespace. Index: gal/e-table/e-table-item.c =================================================================== RCS file: /cvs/gnome/gal/gal/e-table/e-table-item.c,v retrieving revision 1.230 diff -u -r1.230 e-table-item.c --- gal/e-table/e-table-item.c 14 Nov 2003 10:07:26 -0000 1.230 +++ gal/e-table/e-table-item.c 19 Nov 2003 04:12:23 -0000 @@ -553,8 +553,6 @@ eti->cursor_change_id); g_signal_handler_disconnect (eti->selection, eti->cursor_activated_id); - g_signal_emit_by_name (G_OBJECT(eti), - "selection_model_removed", eti->selection); g_object_unref (eti->selection); eti->selection_change_id = 0; @@ -1466,6 +1464,8 @@ break; case PROP_SELECTION_MODEL: + g_signal_emit_by_name (G_OBJECT(eti), + "selection_model_removed", eti->selection); eti_remove_selection_model (eti); if (g_value_get_object (value)) eti_add_selection_model (eti, E_SELECTION_MODEL(g_value_get_object(value))); Index: gal/a11y/e-table/gal-a11y-e-table-item.c =================================================================== RCS file: /cvs/gnome/gal/gal/a11y/e-table/gal-a11y-e-table-item.c,v retrieving revision 1.3 diff -u -r1.3 gal-a11y-e-table-item.c --- gal/a11y/e-table/gal-a11y-e-table-item.c 11 Nov 2003 03:42:58 -0000 1.3 +++ gal/a11y/e-table/gal-a11y-e-table-item.c 19 Nov 2003 04:12:23 -0000 @@ -34,8 +34,13 @@ gint index_in_parent; int selection_change_id; int cursor_change_id; + ESelectionModel *selection; }; +static gboolean gal_a11y_e_table_item_ref_selection (GalA11yETableItem *a11y, + ESelectionModel *selection); +static gboolean gal_a11y_e_table_item_unref_selection (GalA11yETableItem *a11y); + #if 0 static void unref_accessible (gpointer user_data, GObject *obj_loc) @@ -90,6 +95,8 @@ if (parent_class->dispose) parent_class->dispose (object); + if (priv->selection) + gal_a11y_e_table_item_unref_selection (a11y); } /* Static functions */ @@ -471,7 +478,8 @@ if (table_is_row_selected (table, row)) return TRUE; - e_selection_model_toggle_single_row (item->selection, view_to_model_row (item, row)); + e_selection_model_toggle_single_row (item->selection, + view_to_model_row (item, row)); return TRUE; } @@ -554,6 +562,7 @@ priv->index_in_parent = -1; priv->selection_change_id = 0; priv->cursor_change_id = 0; + priv->selection = NULL; } /* atk selection */ @@ -660,16 +669,9 @@ G_CALLBACK (eti_a11y_selection_model_removed_cb), NULL); g_signal_connect (G_OBJECT(item), "selection_model_added", G_CALLBACK (eti_a11y_selection_model_added_cb), NULL); - if (item->selection) { - GET_PRIVATE (a11y)->selection_change_id = g_signal_connect ( - G_OBJECT(item->selection), "selection_changed", - G_CALLBACK (eti_a11y_selection_changed_cb), a11y); - GET_PRIVATE (a11y)->cursor_change_id = g_signal_connect ( - G_OBJECT(item->selection), "cursor_changed", - G_CALLBACK (eti_a11y_cursor_changed_cb), a11y); - - g_object_ref (item->selection); - } + if (item->selection) + gal_a11y_e_table_item_ref_selection (a11y, + item->selection); } if (parent) g_object_ref (parent); @@ -684,6 +686,53 @@ return ATK_OBJECT (a11y); } +static gboolean +gal_a11y_e_table_item_ref_selection (GalA11yETableItem *a11y, + ESelectionModel *selection) +{ + GalA11yETableItemPrivate *priv; + + g_return_val_if_fail (a11y && selection, FALSE); + + priv = GET_PRIVATE (a11y); + priv->selection_change_id = g_signal_connect ( + G_OBJECT(selection), "selection_changed", + G_CALLBACK (eti_a11y_selection_changed_cb), a11y); + priv->cursor_change_id = g_signal_connect ( + G_OBJECT(selection), "cursor_changed", + G_CALLBACK (eti_a11y_cursor_changed_cb), a11y); + + priv->selection = selection; + g_object_ref (selection); + + return TRUE; +} + +static gboolean +gal_a11y_e_table_item_unref_selection (GalA11yETableItem *a11y) +{ + GalA11yETableItemPrivate *priv; + + g_return_val_if_fail (a11y, FALSE); + + priv = GET_PRIVATE (a11y); + + g_return_val_if_fail (priv->selection_change_id != 0, FALSE); + g_return_val_if_fail (priv->cursor_change_id != 0, FALSE); + + + g_signal_handler_disconnect (priv->selection, + priv->selection_change_id); + g_signal_handler_disconnect (priv->selection, + priv->cursor_change_id); + priv->cursor_change_id = 0; + priv->selection_change_id = 0; + + g_object_unref (priv->selection); + priv->selection = NULL; + + return TRUE; +} /* callbacks */ @@ -700,16 +749,8 @@ atk_obj = atk_gobject_accessible_for_object (G_OBJECT (eti)); a11y = GAL_A11Y_E_TABLE_ITEM (atk_obj); - if (GET_PRIVATE (a11y)->selection_change_id != 0 && - GET_PRIVATE (a11y)->cursor_change_id != 0) { - g_signal_handler_disconnect (selection, - GET_PRIVATE (a11y)->selection_change_id); - g_signal_handler_disconnect (selection, - GET_PRIVATE (a11y)->cursor_change_id); - GET_PRIVATE (a11y)->cursor_change_id = 0; - GET_PRIVATE (a11y)->selection_change_id = 0; - g_object_unref (selection); - } + if (selection == GET_PRIVATE (a11y)->selection) + gal_a11y_e_table_item_unref_selection (a11y); } static void @@ -725,14 +766,9 @@ atk_obj = atk_gobject_accessible_for_object (G_OBJECT (eti)); a11y = GAL_A11Y_E_TABLE_ITEM (atk_obj); - GET_PRIVATE (a11y)->selection_change_id = g_signal_connect ( - G_OBJECT(selection), "selection_changed", - G_CALLBACK (eti_a11y_selection_changed_cb), a11y); - GET_PRIVATE (a11y)->cursor_change_id = g_signal_connect ( - G_OBJECT(selection), "cursor_changed", - G_CALLBACK (eti_a11y_cursor_changed_cb), a11y); - - g_object_ref (selection); + if (GET_PRIVATE (a11y)->selection) + gal_a11y_e_table_item_unref_selection (a11y); + gal_a11y_e_table_item_ref_selection (a11y, selection); } static void