diff options
author | Robin Burchell <robin.burchell@jollamobile.com> | 2013-12-03 21:47:02 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-03 22:07:43 +0100 |
commit | cf51cdb8fb002ae3602a4c886e7c67913d77373a (patch) | |
tree | 18a691329c61edc8f86bae756df88a66b0e4ac9a /src/qml/qml/qqmlimport.cpp | |
parent | 321fcab5933d37ca9cb5097892621aa4979b45fa (diff) |
QQmlImport: Don't try use a dangling pointer.
toUtf8 would return a temporary, and constData would hold a pointer inside that
temporary. This isn't even remotely safe. Move the pointer use down to the
initializeEngine call so it is kept around long enough for us to do our stuff.
Task-number: QTBUG-35355
Task-number: QTBUG-35343
Change-Id: Ie816d0d1a37e42607f26d9ad02cf999f3d459cd9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlimport.cpp')
-rw-r--r-- | src/qml/qml/qqmlimport.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index 30b5abb383..8645d2116a 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -1966,8 +1966,7 @@ bool QQmlImportDatabase::importPlugin(const QString &filePath, const QString &ur if (QQmlExtensionInterface *eiface = qobject_cast<QQmlExtensionInterface *>(instance)) { QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine); - const char *moduleId = uri.toUtf8().constData(); - ep->typeLoader.initializeEngine(eiface, moduleId); + ep->typeLoader.initializeEngine(eiface, uri.toUtf8().constData()); } } } |