diff --git a/ChangeLog b/ChangeLog index cccdf2e19e..a74d6da328 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Wed Jan 21 23:27:14 2004 Matthias Clasen + + Fix #131869: + + * gtk/gtkaction.c (_gtk_action_emit_activate): Hold + a reference to the group while emitting the signals. + + * gtk/gtkactiongroup.c (gtk_action_group_init): Use a + destroy notify which does not only unref, but also resets + the action_group property of the action. + 2004-01-20 Federico Mena Quintero * NEWS: Added details about GtkFileChooser changes. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index cccdf2e19e..a74d6da328 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,14 @@ +Wed Jan 21 23:27:14 2004 Matthias Clasen + + Fix #131869: + + * gtk/gtkaction.c (_gtk_action_emit_activate): Hold + a reference to the group while emitting the signals. + + * gtk/gtkactiongroup.c (gtk_action_group_init): Use a + destroy notify which does not only unref, but also resets + the action_group property of the action. + 2004-01-20 Federico Mena Quintero * NEWS: Added details about GtkFileChooser changes. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index cccdf2e19e..a74d6da328 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,14 @@ +Wed Jan 21 23:27:14 2004 Matthias Clasen + + Fix #131869: + + * gtk/gtkaction.c (_gtk_action_emit_activate): Hold + a reference to the group while emitting the signals. + + * gtk/gtkactiongroup.c (gtk_action_group_init): Use a + destroy notify which does not only unref, but also resets + the action_group property of the action. + 2004-01-20 Federico Mena Quintero * NEWS: Added details about GtkFileChooser changes. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index cccdf2e19e..a74d6da328 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,14 @@ +Wed Jan 21 23:27:14 2004 Matthias Clasen + + Fix #131869: + + * gtk/gtkaction.c (_gtk_action_emit_activate): Hold + a reference to the group while emitting the signals. + + * gtk/gtkactiongroup.c (gtk_action_group_init): Use a + destroy notify which does not only unref, but also resets + the action_group property of the action. + 2004-01-20 Federico Mena Quintero * NEWS: Added details about GtkFileChooser changes. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index cccdf2e19e..a74d6da328 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,14 @@ +Wed Jan 21 23:27:14 2004 Matthias Clasen + + Fix #131869: + + * gtk/gtkaction.c (_gtk_action_emit_activate): Hold + a reference to the group while emitting the signals. + + * gtk/gtkactiongroup.c (gtk_action_group_init): Use a + destroy notify which does not only unref, but also resets + the action_group property of the action. + 2004-01-20 Federico Mena Quintero * NEWS: Added details about GtkFileChooser changes. diff --git a/gtk/gtkaction.c b/gtk/gtkaction.c index e54e3ba87e..7c5a2076eb 100644 --- a/gtk/gtkaction.c +++ b/gtk/gtkaction.c @@ -957,13 +957,19 @@ _gtk_action_emit_activate (GtkAction *action) { GtkActionGroup *group = action->private_data->action_group; - if (group != NULL) - _gtk_action_group_emit_pre_activate (group, action); + if (group != NULL) + { + g_object_ref (group); + _gtk_action_group_emit_pre_activate (group, action); + } g_signal_emit (action, action_signals[ACTIVATE], 0); - if (group != NULL) - _gtk_action_group_emit_post_activate (group, action); + if (group != NULL) + { + _gtk_action_group_emit_post_activate (group, action); + g_object_unref (group); + } } /** diff --git a/gtk/gtkactiongroup.c b/gtk/gtkactiongroup.c index 1b383245a2..72ff6e4dfa 100644 --- a/gtk/gtkactiongroup.c +++ b/gtk/gtkactiongroup.c @@ -246,6 +246,14 @@ gtk_action_group_class_init (GtkActionGroupClass *klass) g_type_class_add_private (gobject_class, sizeof (GtkActionGroupPrivate)); } + +static void +remove_action (GtkAction *action) +{ + g_object_set (action, "action_group", NULL, NULL); + g_object_unref (action); +} + static void gtk_action_group_init (GtkActionGroup *self) { @@ -255,7 +263,7 @@ gtk_action_group_init (GtkActionGroup *self) self->private_data->visible = TRUE; self->private_data->actions = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, - (GDestroyNotify) g_object_unref); + (GDestroyNotify) remove_action); self->private_data->translate_func = NULL; self->private_data->translate_data = NULL; self->private_data->translate_notify = NULL; @@ -609,7 +617,6 @@ gtk_action_group_remove_action (GtkActionGroup *action_group, /* extra protection to make sure action->name is valid */ g_object_ref (action); g_hash_table_remove (action_group->private_data->actions, gtk_action_get_name (action)); - g_object_set (G_OBJECT (action), "action_group", NULL, NULL); g_object_unref (action); }