From: Robin Burchell Date: Mon, 7 Oct 2013 23:23:15 +0000 (+0200) Subject: Delay calculation of offline storage path as long as is practically possible. X-Git-Tag: upstream/5.2.1~273 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=29e3d02c26d264adb2b581b3511d29efb124f331;p=platform%2Fupstream%2Fqtdeclarative.git Delay calculation of offline storage path as long as is practically possible. This avoids calculating it incorrectly in the case that something later clobbers argv, such as a zygote or booster-type mechanism. Change-Id: Ifab16c7c94e9ee3fded0dfda2266a12c910858ee Reviewed-by: Matthew Vogt Reviewed-by: Martin Jones --- diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index c8b602e..64cde85 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -803,12 +803,6 @@ void QQmlEnginePrivate::init() QQmlProfilerService::initialize(); QDebugMessageService::instance(); } - - QString dataLocation = QStandardPaths::writableLocation(QStandardPaths::DataLocation); - if (!dataLocation.isEmpty()) - offlineStoragePath = dataLocation.replace(QLatin1Char('/'), QDir::separator()) - + QDir::separator() + QLatin1String("QML") - + QDir::separator() + QLatin1String("OfflineStorage"); } QQuickWorkerScriptEngine *QQmlEnginePrivate::getWorkerScriptEngine() @@ -1995,6 +1989,16 @@ void QQmlEngine::setOfflineStoragePath(const QString& dir) QString QQmlEngine::offlineStoragePath() const { Q_D(const QQmlEngine); + + if (d->offlineStoragePath.isEmpty()) { + QString dataLocation = QStandardPaths::writableLocation(QStandardPaths::DataLocation); + QQmlEnginePrivate *e = const_cast(d); + if (!dataLocation.isEmpty()) + e->offlineStoragePath = dataLocation.replace(QLatin1Char('/'), QDir::separator()) + + QDir::separator() + QLatin1String("QML") + + QDir::separator() + QLatin1String("OfflineStorage"); + } + return d->offlineStoragePath; }