summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qcoreapplication.cpp
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@jollamobile.com>2013-10-09 00:55:39 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-20 19:25:47 +0100
commite70ecc06b1e266b73f47291aa037114bd3d1baf7 (patch)
treea453d35f2a762db00a335027ff4a1fa583b813eb /src/corelib/kernel/qcoreapplication.cpp
parent982da20cf2b58dd6f42e70d406c37219ea204a78 (diff)
Clear QCoreApplication::applicationFilePath cache if argv[0] changes.
This allows boosters to precreate Q*Application instances. Change-Id: Ie2c1399b216d9cc996210e077fa6d42d24bf9b0e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qcoreapplication.cpp')
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 43c64b7b2c..61ad4f9be1 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -1939,6 +1939,14 @@ QString QCoreApplication::applicationFilePath()
}
QCoreApplicationPrivate *d = self->d_func();
+
+ static char *procName = d->argv[0];
+ if (qstrcmp(procName, d->argv[0]) != 0) {
+ // clear the cache if the procname changes, so we reprocess it.
+ d->cachedApplicationFilePath = QString();
+ procName = d->argv[0];
+ }
+
if (!d->cachedApplicationFilePath.isNull())
return d->cachedApplicationFilePath;