diff options
author | Samuel Rødal <samuel.rodal@digia.com> | 2013-04-23 08:41:08 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-24 06:49:44 +0200 |
commit | 9d7fe3eb3dcb71926b3db65df835d45fc431eebb (patch) | |
tree | 5b64c1eb1e17e5511f5c7744a192aa3a70114685 /src/gui | |
parent | af35ee291a1bbbc8627f9a17f7e104898d49b138 (diff) |
Fixed crashes relating to SVG icons.
Creating a second QFactoryLoader for the same plugins seems to trigger
an unload of the plugins loaded by the first factory loader. The
QIconEngine created by the SVG icon plugin thus gets an invalid virtual
table pointer, which causes a crash when attempting to call any virtual
function in the QIconEngine (pixmap(), the virtual destructor, etc).
Reusing a single QFactoryLoader instead fixes the crash.
Task-number: QTBUG-30496
Change-Id: I80c5fa8b52ab9b0db68499f8c37fad14a1ac4f3c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/image/qicon.cpp | 5 | ||||
-rw-r--r-- | src/gui/image/qiconloader.cpp | 9 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index d73cd0aa57..45eda78397 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -483,6 +483,11 @@ void QPixmapIconEngine::virtual_hook(int id, void *data) #ifndef QT_NO_LIBRARY Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QIconEngineFactoryInterface_iid, QLatin1String("/iconengines"), Qt::CaseInsensitive)) + +QFactoryLoader *qt_iconEngineFactoryLoader() +{ + return loader(); +} #endif diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index c2e5161bd3..105dc26c9b 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/gui/image/qiconloader.cpp @@ -104,6 +104,10 @@ static inline QStringList systemIconSearchPaths() return QStringList(); } +#ifndef QT_NO_LIBRARY +extern QFactoryLoader *qt_iconEngineFactoryLoader(); // qicon.cpp +#endif + void QIconLoader::ensureInitialized() { if (!m_initialized) { @@ -116,10 +120,7 @@ void QIconLoader::ensureInitialized() if (m_systemTheme.isEmpty()) m_systemTheme = fallbackTheme(); #ifndef QT_NO_LIBRARY - QFactoryLoader iconFactoryLoader(QIconEngineFactoryInterface_iid, - QLatin1String("/iconengines"), - Qt::CaseInsensitive); - if (iconFactoryLoader.keyMap().key(QLatin1String("svg"), -1) != -1) + if (qt_iconEngineFactoryLoader()->keyMap().key(QLatin1String("svg"), -1) != -1) m_supportsSvg = true; #endif //QT_NO_LIBRARY } |