From e70ecc06b1e266b73f47291aa037114bd3d1baf7 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Wed, 9 Oct 2013 00:55:39 +0200 Subject: Clear QCoreApplication::applicationFilePath cache if argv[0] changes. This allows boosters to precreate Q*Application instances. Change-Id: Ie2c1399b216d9cc996210e077fa6d42d24bf9b0e Reviewed-by: Thiago Macieira --- src/corelib/kernel/qcoreapplication.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/corelib/kernel/qcoreapplication.cpp') 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; -- cgit v1.2.3