Merge lp:~larsu/ido/lp1246536 into lp:ido/14.04

Proposed by Lars Karlitski
Status: Merged
Approved by: Sebastien Bacher
Approved revision: 156
Merged at revision: 156
Proposed branch: lp:~larsu/ido/lp1246536
Merge into: lp:ido/14.04
Diff against target: 67 lines (+14/-21)
1 file modified
src/idoscalemenuitem.c (+14/-21)
To merge this branch: bzr merge lp:~larsu/ido/lp1246536
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+193470@code.launchpad.net

Description of the change

idoscalemenuitem: disconnect signal from parent

This fixes a crash: the widget installed a handler for the parent's hide signal, but was destroyed before the parent without disconnecting the signal.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/idoscalemenuitem.c'
--- src/idoscalemenuitem.c 2013-10-10 05:30:45 +0000
+++ src/idoscalemenuitem.c 2013-10-31 18:20:44 +0000
@@ -52,9 +52,8 @@
52static void ido_scale_menu_item_secondary_image_notify (GtkImage *image,52static void ido_scale_menu_item_secondary_image_notify (GtkImage *image,
53 GParamSpec *pspec,53 GParamSpec *pspec,
54 IdoScaleMenuItem *item);54 IdoScaleMenuItem *item);
55static void ido_scale_menu_item_notify (IdoScaleMenuItem *item,55static void ido_scale_menu_item_parent_set (GtkWidget *item,
56 GParamSpec *pspec,56 GtkWidget *previous_parent);
57 gpointer user_data);
58static void update_packing (IdoScaleMenuItem *self,57static void update_packing (IdoScaleMenuItem *self,
59 IdoScaleMenuItemStyle style);58 IdoScaleMenuItemStyle style);
60static void default_primary_clicked_handler (IdoScaleMenuItem *self);59static void default_primary_clicked_handler (IdoScaleMenuItem *self);
@@ -265,10 +264,6 @@
265 G_CALLBACK (ido_scale_menu_item_toggle_size_allocate),264 G_CALLBACK (ido_scale_menu_item_toggle_size_allocate),
266 NULL);265 NULL);
267266
268 g_signal_connect (self, "notify",
269 G_CALLBACK (ido_scale_menu_item_notify),
270 NULL);
271
272 gtk_container_add (GTK_CONTAINER (self), hbox);267 gtk_container_add (GTK_CONTAINER (self), hbox);
273268
274 gtk_widget_add_events (GTK_WIDGET(self), GDK_SCROLL_MASK);269 gtk_widget_add_events (GTK_WIDGET(self), GDK_SCROLL_MASK);
@@ -288,6 +283,7 @@
288 widget_class->motion_notify_event = ido_scale_menu_item_motion_notify_event;283 widget_class->motion_notify_event = ido_scale_menu_item_motion_notify_event;
289 widget_class->scroll_event = ido_scale_menu_item_scroll_event;284 widget_class->scroll_event = ido_scale_menu_item_scroll_event;
290 widget_class->size_allocate = ido_scale_menu_item_size_allocate;285 widget_class->size_allocate = ido_scale_menu_item_size_allocate;
286 widget_class->parent_set = ido_scale_menu_item_parent_set;
291287
292 gobject_class->constructed = ido_scale_menu_item_constructed;288 gobject_class->constructed = ido_scale_menu_item_constructed;
293 gobject_class->set_property = ido_scale_menu_item_set_property;289 gobject_class->set_property = ido_scale_menu_item_set_property;
@@ -645,21 +641,18 @@
645}641}
646642
647static void643static void
648ido_scale_menu_item_notify (IdoScaleMenuItem *item,644ido_scale_menu_item_parent_set (GtkWidget *item,
649 GParamSpec *pspec,645 GtkWidget *previous_parent)
650 gpointer user_data)646
651{647{
652 if (g_strcmp0 (pspec->name, "parent"))648 GtkWidget *parent;
653 {649
654 GtkWidget *parent = gtk_widget_get_parent (GTK_WIDGET (item));650 if (previous_parent)
655651 g_signal_handlers_disconnect_by_func (previous_parent, menu_hidden, item);
656 if (parent)652
657 {653 parent = gtk_widget_get_parent (item);
658 g_signal_connect (parent, "hide",654 if (parent)
659 G_CALLBACK (menu_hidden),655 g_signal_connect (parent, "hide", G_CALLBACK (menu_hidden), item);
660 item);
661 }
662 }
663}656}
664657
665static void658static void

Subscribers

People subscribed via source and target branches