Merge lp:~azzar1/unity/fix-935307 into lp:unity

Proposed by Andrea Azzarone
Status: Merged
Approved by: Tim Penhey
Approved revision: no longer in the source branch.
Merged at revision: 2265
Proposed branch: lp:~azzar1/unity/fix-935307
Merge into: lp:unity
Diff against target: 92 lines (+19/-12)
2 files modified
plugins/unityshell/src/IconTexture.cpp (+18/-12)
plugins/unityshell/src/IconTexture.h (+1/-0)
To merge this branch: bzr merge lp:~azzar1/unity/fix-935307
Reviewer Review Type Date Requested Status
Tim Penhey (community) Approve
Review via email: mp+101469@code.launchpad.net

Commit message

Disconnect IconLoader handle in IconTexture destructor

Description of the change

== Problem ==
compiz crashed with SIGSEGV in unity::hud::HudIconTextureSource::ColorForIcon()

== Fix ==
Disconnect IconLoader handle in IconTexture dtor.

UNBLOCK

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/IconTexture.cpp'
2--- plugins/unityshell/src/IconTexture.cpp 2012-04-06 09:34:57 +0000
3+++ plugins/unityshell/src/IconTexture.cpp 2012-04-11 01:13:22 +0000
4@@ -51,7 +51,8 @@
5 _texture_width(width),
6 _texture_height(height),
7 _loading(false),
8- _opacity(1.0f)
9+ _opacity(1.0f),
10+ _handle(0)
11 {
12 SetMinMaxSize(width, height);
13 }
14@@ -64,14 +65,17 @@
15 _texture_width(0),
16 _texture_height(0),
17 _loading(false),
18- _opacity(1.0f)
19+ _opacity(1.0f),
20+ _handle(0)
21 {
22 if (!icon_name.empty () && !defer_icon_loading)
23 LoadIcon();
24 }
25
26 IconTexture::~IconTexture()
27-{}
28+{
29+ IconLoader::GetDefault().DisconnectHandle(_handle);
30+}
31
32 void IconTexture::SetByIconName(std::string const& icon_name, unsigned int size)
33 {
34@@ -101,7 +105,7 @@
35 LOG_DEBUG(logger) << "LoadIcon called (" << _icon_name << ") - loading: " << _loading;
36 static const char* const DEFAULT_GICON = ". GThemedIcon text-x-preview";
37
38- if (_loading || _size == 0)
39+ if (_loading || _size == 0 || _handle)
40 return;
41
42 _loading = true;
43@@ -110,20 +114,20 @@
44
45 if (icon)
46 {
47- IconLoader::GetDefault().LoadFromGIconString(_icon_name.empty() ? DEFAULT_GICON : _icon_name.c_str(),
48- _size,
49- sigc::mem_fun(this, &IconTexture::IconLoaded));
50+ _handle = IconLoader::GetDefault().LoadFromGIconString(_icon_name.empty() ? DEFAULT_GICON : _icon_name.c_str(),
51+ _size,
52+ sigc::mem_fun(this, &IconTexture::IconLoaded));
53 }
54 else if (_icon_name.find("http://") == 0)
55 {
56- IconLoader::GetDefault().LoadFromURI(_icon_name,
57- _size, sigc::mem_fun(this, &IconTexture::IconLoaded));
58+ _handle = IconLoader::GetDefault().LoadFromURI(_icon_name,
59+ _size, sigc::mem_fun(this, &IconTexture::IconLoaded));
60 }
61 else
62 {
63- IconLoader::GetDefault().LoadFromIconName(_icon_name,
64- _size,
65- sigc::mem_fun(this, &IconTexture::IconLoaded));
66+ _handle = IconLoader::GetDefault().LoadFromIconName(_icon_name,
67+ _size,
68+ sigc::mem_fun(this, &IconTexture::IconLoaded));
69 }
70 }
71
72@@ -155,6 +159,8 @@
73 void IconTexture::IconLoaded(std::string const& icon_name, unsigned size,
74 GdkPixbuf* pixbuf)
75 {
76+ _handle = 0;
77+
78 if (GDK_IS_PIXBUF(pixbuf))
79 {
80 Refresh(pixbuf);
81
82=== modified file 'plugins/unityshell/src/IconTexture.h'
83--- plugins/unityshell/src/IconTexture.h 2012-03-27 14:10:40 +0000
84+++ plugins/unityshell/src/IconTexture.h 2012-04-11 01:13:22 +0000
85@@ -84,6 +84,7 @@
86 bool _loading;
87
88 float _opacity;
89+ int _handle;
90 };
91
92 }