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>
bb10
Robin Burchell 2013-10-09 00:55:39 +02:00 committed by The Qt Project
parent 982da20cf2
commit e70ecc06b1
1 changed files with 8 additions and 0 deletions

View File

@ -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;