Merge lp:~unity-team/unity/unity.fix-742110 into lp:unity

Proposed by Mirco Müller
Status: Merged
Approved by: Mirco Müller
Approved revision: no longer in the source branch.
Merged at revision: 1030
Proposed branch: lp:~unity-team/unity/unity.fix-742110
Merge into: lp:unity
Diff against target: 59 lines (+19/-7)
2 files modified
src/SimpleLauncherIcon.cpp (+12/-6)
src/SimpleLauncherIcon.h (+7/-1)
To merge this branch: bzr merge lp:~unity-team/unity/unity.fix-742110
Reviewer Review Type Date Requested Status
Mikkel Kamstrup Erlandsen (community) Approve
Review via email: mp+55114@code.launchpad.net

Description of the change

Storing connection-objects for all sigc-signal-handers being connected in constructor, so they the can be cleanly disconnected upon object destruction.

To post a comment you must log in.
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

 review approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/SimpleLauncherIcon.cpp'
2--- src/SimpleLauncherIcon.cpp 2011-03-24 10:16:40 +0000
3+++ src/SimpleLauncherIcon.cpp 2011-03-28 10:08:32 +0000
4@@ -30,12 +30,12 @@
5 {
6 m_Icon = 0;
7 m_IconName = 0;
8-
9- LauncherIcon::MouseDown.connect (sigc::mem_fun (this, &SimpleLauncherIcon::OnMouseDown));
10- LauncherIcon::MouseUp.connect (sigc::mem_fun (this, &SimpleLauncherIcon::OnMouseUp));
11- LauncherIcon::MouseClick.connect (sigc::mem_fun (this, &SimpleLauncherIcon::OnMouseClick));
12- LauncherIcon::MouseEnter.connect (sigc::mem_fun (this, &SimpleLauncherIcon::OnMouseEnter));
13- LauncherIcon::MouseLeave.connect (sigc::mem_fun (this, &SimpleLauncherIcon::OnMouseLeave));
14+
15+ _on_mouse_down_connection = (sigc::connection) LauncherIcon::MouseDown.connect (sigc::mem_fun (this, &SimpleLauncherIcon::OnMouseDown));
16+ _on_mouse_up_connection = (sigc::connection) LauncherIcon::MouseUp.connect (sigc::mem_fun (this, &SimpleLauncherIcon::OnMouseUp));
17+ _on_mouse_click_connection = (sigc::connection) LauncherIcon::MouseClick.connect (sigc::mem_fun (this, &SimpleLauncherIcon::OnMouseClick));
18+ _on_mouse_enter_connection = (sigc::connection) LauncherIcon::MouseEnter.connect (sigc::mem_fun (this, &SimpleLauncherIcon::OnMouseEnter));
19+ _on_mouse_leave_connection = (sigc::connection) LauncherIcon::MouseLeave.connect (sigc::mem_fun (this, &SimpleLauncherIcon::OnMouseLeave));
20
21 _theme_changed_id = g_signal_connect (gtk_icon_theme_get_default (), "changed",
22 G_CALLBACK (SimpleLauncherIcon::OnIconThemeChanged), this);
23@@ -43,6 +43,12 @@
24
25 SimpleLauncherIcon::~SimpleLauncherIcon()
26 {
27+ _on_mouse_down_connection.disconnect ();
28+ _on_mouse_up_connection.disconnect ();
29+ _on_mouse_click_connection.disconnect ();
30+ _on_mouse_enter_connection.disconnect ();
31+ _on_mouse_leave_connection.disconnect ();
32+
33 if (m_Icon)
34 m_Icon->UnReference ();
35
36
37=== modified file 'src/SimpleLauncherIcon.h'
38--- src/SimpleLauncherIcon.h 2011-03-24 10:16:40 +0000
39+++ src/SimpleLauncherIcon.h 2011-03-28 10:08:32 +0000
40@@ -43,12 +43,18 @@
41 virtual void OnMouseLeave ();
42
43 private:
44-
45+
46 char *m_IconName;
47 nux::BaseTexture *m_Icon;
48 void ActivateLauncherIcon ();
49 static void OnIconThemeChanged (GtkIconTheme* icon_theme, gpointer data);
50 guint32 _theme_changed_id;
51+
52+ sigc::connection _on_mouse_down_connection;
53+ sigc::connection _on_mouse_up_connection;
54+ sigc::connection _on_mouse_click_connection;
55+ sigc::connection _on_mouse_enter_connection;
56+ sigc::connection _on_mouse_leave_connection;
57 };
58
59 #endif // SIMPLELAUNCHERICON_H