diff options
author | Albert Astals Cid <albert.astals@canonical.com> | 2012-12-20 11:01:22 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-12-20 11:16:07 +0100 |
commit | 23e8618566930a1fd9a67d8a659fc6d1d056f819 (patch) | |
tree | 5c86f7333a394081d3bf1ed10b34f9907f883e70 /src/plugins | |
parent | 74a697a8eb7de89184a71aaefd08747e5172ca0e (diff) | |
download | qtsvg-23e8618566930a1fd9a67d8a659fc6d1d056f819.tar.gz |
Fix crash when running in a QGuiApplication
A QGuiApplication has no style so crashes on a null pointer or asserts
in qtbase
Changed test to not depend on widgets so we get
a QGuiApplication instead of a QApplication
Change-Id: Ib4dcc8f8679d3e6b8c11f7ccd5b2539c9de0803b
Reviewed-by: Richard J. Moore <rich@kde.org>
Reviewed-by: David Faure (KDE) <faure@kde.org>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp b/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp index 902e59d..6d84df1 100644 --- a/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp +++ b/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp @@ -180,11 +180,13 @@ QPixmap QSvgIconEngine::pixmap(const QSize &size, QIcon::Mode mode, renderer.render(&p); p.end(); pm = QPixmap::fromImage(img); - QStyleOption opt(0); - opt.palette = QApplication::palette(); - QPixmap generated = QApplication::style()->generatedIconPixmap(mode, pm, &opt); - if (!generated.isNull()) - pm = generated; + if (qobject_cast<QApplication *>(QCoreApplication::instance())) { + QStyleOption opt(0); + opt.palette = QGuiApplication::palette(); + QPixmap generated = QApplication::style()->generatedIconPixmap(mode, pm, &opt); + if (!generated.isNull()) + pm = generated; + } if (!pm.isNull()) QPixmapCache::insert(pmckey, pm); |