Merge lp:~fboucault/ubuntu-ui-toolkit/gicon_no_qpixmap into lp:ubuntu-ui-toolkit

Proposed by Florian Boucault
Status: Merged
Approved by: Florian Boucault
Approved revision: 596
Merged at revision: 599
Proposed branch: lp:~fboucault/ubuntu-ui-toolkit/gicon_no_qpixmap
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 40 lines (+5/-5)
1 file modified
modules/Ubuntu/Components/plugin/giconprovider.cpp (+5/-5)
To merge this branch: bzr merge lp:~fboucault/ubuntu-ui-toolkit/gicon_no_qpixmap
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ubuntu SDK team Pending
Review via email: mp+173734@code.launchpad.net

Commit message

GIconProvider: avoid using QPixmap which is not re-entrant. Fixes crashes.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'modules/Ubuntu/Components/plugin/giconprovider.cpp'
--- modules/Ubuntu/Components/plugin/giconprovider.cpp 2012-11-28 13:21:48 +0000
+++ modules/Ubuntu/Components/plugin/giconprovider.cpp 2013-07-09 14:26:22 +0000
@@ -59,7 +59,7 @@
5959
60QImage GIconProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)60QImage GIconProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
61{61{
62 QPixmap result;62 QImage result;
63 QByteArray utf8Name = QUrl::fromPercentEncoding(id.toUtf8()).toUtf8();63 QByteArray utf8Name = QUrl::fromPercentEncoding(id.toUtf8()).toUtf8();
64 GError *error = NULL;64 GError *error = NULL;
65 GIcon *icon = g_icon_new_for_string(utf8Name.data(), &error);65 GIcon *icon = g_icon_new_for_string(utf8Name.data(), &error);
@@ -73,9 +73,9 @@
73 QIcon themedIcon = getThemedIcon(reinterpret_cast<GThemedIcon*>(icon));73 QIcon themedIcon = getThemedIcon(reinterpret_cast<GThemedIcon*>(icon));
74 if (!themedIcon.isNull()) {74 if (!themedIcon.isNull()) {
75 if (requestedSize.isValid()) {75 if (requestedSize.isValid()) {
76 result = themedIcon.pixmap(requestedSize);76 result = themedIcon.pixmap(requestedSize).toImage();
77 } else {77 } else {
78 result = themedIcon.pixmap(themedIcon.availableSizes().last());78 result = themedIcon.pixmap(themedIcon.availableSizes().last()).toImage();
79 }79 }
80 } else {80 } else {
81 qDebug() << "Fail to load themed icon for:" << id;81 qDebug() << "Fail to load themed icon for:" << id;
@@ -83,7 +83,7 @@
83 } else if (G_IS_FILE_ICON(icon)) {83 } else if (G_IS_FILE_ICON(icon)) {
84 gchar *iconName = g_icon_to_string(icon);84 gchar *iconName = g_icon_to_string(icon);
85 if (QFile::exists(iconName)) {85 if (QFile::exists(iconName)) {
86 result = QPixmap(iconName);86 result.load(iconName);
87 if (requestedSize.isValid()) {87 if (requestedSize.isValid()) {
88 result = result.scaled(requestedSize);88 result = result.scaled(requestedSize);
89 }89 }
@@ -98,5 +98,5 @@
9898
99 g_object_unref(icon);99 g_object_unref(icon);
100 *size = result.size();100 *size = result.size();
101 return result.toImage();101 return result;
102}102}

Subscribers

People subscribed via source and target branches

to status/vote changes: