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>
This commit is contained in:
parent
af35ee291a
commit
9d7fe3eb3d
@ -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
|
||||
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user