Merge lp:~larsu/ido/lp1246536-13.10 into lp:ido/13.10

Proposed by Lars Karlitski on 2013-10-31
Status: Merged
Approved by: Sebastien Bacher on 2013-10-31
Approved revision: 154
Merged at revision: 154
Proposed branch: lp:~larsu/ido/lp1246536-13.10
Merge into: lp:ido/13.10
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-13.10
Reviewer Review Type Date Requested Status
Sebastien Bacher Approve on 2013-10-31
Charles Kerr (community) 2013-10-31 Approve on 2013-10-31
PS Jenkins bot (community) continuous-integration Approve on 2013-10-31
Review via email: mp+193474@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.
Charles Kerr (charlesk) :
review: Approve
Sebastien Bacher (seb128) wrote :

looks good, seems to fix the issue as well ;-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/idoscalemenuitem.c'
2--- src/idoscalemenuitem.c 2013-10-10 05:30:45 +0000
3+++ src/idoscalemenuitem.c 2013-10-31 18:29:47 +0000
4@@ -52,9 +52,8 @@
5 static void ido_scale_menu_item_secondary_image_notify (GtkImage *image,
6 GParamSpec *pspec,
7 IdoScaleMenuItem *item);
8-static void ido_scale_menu_item_notify (IdoScaleMenuItem *item,
9- GParamSpec *pspec,
10- gpointer user_data);
11+static void ido_scale_menu_item_parent_set (GtkWidget *item,
12+ GtkWidget *previous_parent);
13 static void update_packing (IdoScaleMenuItem *self,
14 IdoScaleMenuItemStyle style);
15 static void default_primary_clicked_handler (IdoScaleMenuItem *self);
16@@ -265,10 +264,6 @@
17 G_CALLBACK (ido_scale_menu_item_toggle_size_allocate),
18 NULL);
19
20- g_signal_connect (self, "notify",
21- G_CALLBACK (ido_scale_menu_item_notify),
22- NULL);
23-
24 gtk_container_add (GTK_CONTAINER (self), hbox);
25
26 gtk_widget_add_events (GTK_WIDGET(self), GDK_SCROLL_MASK);
27@@ -288,6 +283,7 @@
28 widget_class->motion_notify_event = ido_scale_menu_item_motion_notify_event;
29 widget_class->scroll_event = ido_scale_menu_item_scroll_event;
30 widget_class->size_allocate = ido_scale_menu_item_size_allocate;
31+ widget_class->parent_set = ido_scale_menu_item_parent_set;
32
33 gobject_class->constructed = ido_scale_menu_item_constructed;
34 gobject_class->set_property = ido_scale_menu_item_set_property;
35@@ -645,21 +641,18 @@
36 }
37
38 static void
39-ido_scale_menu_item_notify (IdoScaleMenuItem *item,
40- GParamSpec *pspec,
41- gpointer user_data)
42+ido_scale_menu_item_parent_set (GtkWidget *item,
43+ GtkWidget *previous_parent)
44+
45 {
46- if (g_strcmp0 (pspec->name, "parent"))
47- {
48- GtkWidget *parent = gtk_widget_get_parent (GTK_WIDGET (item));
49-
50- if (parent)
51- {
52- g_signal_connect (parent, "hide",
53- G_CALLBACK (menu_hidden),
54- item);
55- }
56- }
57+ GtkWidget *parent;
58+
59+ if (previous_parent)
60+ g_signal_handlers_disconnect_by_func (previous_parent, menu_hidden, item);
61+
62+ parent = gtk_widget_get_parent (item);
63+ if (parent)
64+ g_signal_connect (parent, "hide", G_CALLBACK (menu_hidden), item);
65 }
66
67 static void

Subscribers

People subscribed via source and target branches