Merge lp:~gordallott/unity/fixes-08-04 into lp:unity

Proposed by Gord Allott
Status: Merged
Approved by: Gord Allott
Approved revision: no longer in the source branch.
Merged at revision: 1101
Proposed branch: lp:~gordallott/unity/fixes-08-04
Merge into: lp:unity
Diff against target: 131 lines (+28/-4)
5 files modified
src/IconTexture.cpp (+15/-2)
src/Launcher.cpp (+8/-2)
src/Launcher.h (+2/-0)
src/PlacesStyle.cpp (+1/-0)
src/StaticCairoText.cpp (+2/-0)
To merge this branch: bzr merge lp:~gordallott/unity/fixes-08-04
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Review via email: mp+57075@code.launchpad.net

Description of the change

fixes attached bug and a few mem leaks

To post a comment you must log in.
Revision history for this message
Jason Smith (jassmith) wrote :

+1 looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/IconTexture.cpp'
2--- src/IconTexture.cpp 2011-03-24 01:01:59 +0000
3+++ src/IconTexture.cpp 2011-04-10 15:18:35 +0000
4@@ -70,9 +70,14 @@
5 IconTexture::~IconTexture ()
6 {
7 g_free (_icon_name);
8-
9 if (_texture_cached)
10+ {
11 _texture_cached->UnReference ();
12+ if (_texture_cached->GetReferenceCount () == 1)
13+ {
14+ _texture_cached->UnReference ();
15+ }
16+ }
17 }
18
19 void
20@@ -138,7 +143,6 @@
21 {
22 TextureCache *cache = TextureCache::GetDefault ();
23 char *id = NULL;
24-
25 _pixbuf_cached = pixbuf;
26
27 // Cache the pixbuf dimensions so we scale correctly
28@@ -148,7 +152,11 @@
29 // Try and get a texture from the texture cache
30 id = g_strdup_printf ("IconTexture.%s", _icon_name);
31 if (_texture_cached)
32+ {
33 _texture_cached->UnReference ();
34+ if (_texture_cached->GetReferenceCount () == 1)
35+ _texture_cached->UnReference ();
36+ }
37
38 _texture_cached = cache->FindTexture (id,
39 _texture_width,
40@@ -224,7 +232,12 @@
41 IconTexture::SetTexture (nux::BaseTexture *texture)
42 {
43 if (_texture_cached)
44+ {
45 _texture_cached->UnReference ();
46+ if (_texture_cached->GetReferenceCount () == 1)
47+ _texture_cached->UnReference ();
48+ }
49+
50 _texture_cached = texture;
51 _texture_cached->Reference ();
52 }
53
54=== modified file 'src/Launcher.cpp'
55--- src/Launcher.cpp 2011-04-10 05:27:31 +0000
56+++ src/Launcher.cpp 2011-04-10 15:18:35 +0000
57@@ -252,6 +252,8 @@
58 _set_hidden_connection = (sigc::connection) _hide_machine->should_hide_changed.connect (sigc::mem_fun (this, &Launcher::SetHidden));
59 _hover_machine = new LauncherHoverMachine ();
60 _set_hover_connection = (sigc::connection) _hover_machine->should_hover_changed.connect (sigc::mem_fun (this, &Launcher::SetHover));
61+
62+ _launcher_animation_timeout = 0;
63
64 m_Layout = new nux::HLayout(NUX_TRACKER_LOCATION);
65
66@@ -545,6 +547,9 @@
67 if (_on_drag_finish_connection.connected ())
68 _on_drag_finish_connection.disconnect ();
69
70+ if (_launcher_animation_timeout > 0)
71+ g_source_remove (_launcher_animation_timeout);
72+
73 }
74
75 /* Introspection */
76@@ -880,6 +885,7 @@
77 {
78 Launcher *self = (Launcher*) data;
79 self->NeedRedraw ();
80+ self->_launcher_animation_timeout = 0;
81 return false;
82 }
83
84@@ -2685,8 +2691,8 @@
85 float launcher_alpha = 1.0f;
86
87 // rely on the compiz event loop to come back to us in a nice throttling
88- if (AnimationInProgress ())
89- g_timeout_add (0, &Launcher::AnimationTimeout, this);
90+ if (AnimationInProgress ())
91+ _launcher_animation_timeout = g_timeout_add (0, &Launcher::AnimationTimeout, this);
92
93 nux::ROPConfig ROP;
94 ROP.Blend = false;
95
96=== modified file 'src/Launcher.h'
97--- src/Launcher.h 2011-04-10 03:39:11 +0000
98+++ src/Launcher.h 2011-04-10 15:18:35 +0000
99@@ -503,6 +503,8 @@
100 LauncherIcon *_dnd_hovered_icon;
101
102 Atom _selection_atom;
103+
104+ guint _launcher_animation_timeout;
105
106 /* gdbus */
107 guint _dbus_owner;
108
109=== modified file 'src/PlacesStyle.cpp'
110--- src/PlacesStyle.cpp 2011-03-23 22:33:25 +0000
111+++ src/PlacesStyle.cpp 2011-04-10 15:18:35 +0000
112@@ -243,6 +243,7 @@
113 g_object_unref (pixbuf);
114 }
115
116+ texture->Reference (); // stop it getting unreffed by IconTexture
117 return texture;
118 }
119
120
121=== modified file 'src/StaticCairoText.cpp'
122--- src/StaticCairoText.cpp 2011-04-10 05:50:16 +0000
123+++ src/StaticCairoText.cpp 2011-04-10 15:18:35 +0000
124@@ -490,6 +490,8 @@
125
126 _texture2D = GetThreadGLDeviceFactory()->CreateSystemCapableTexture ();
127 _texture2D->Update (bitmap);
128+
129+ delete bitmap;
130
131 cairo_destroy (cr);
132