Fix crash when using QCoreApplication::applicationName in a global static

e.g. when a global-static configuration object uses QTemporaryFile
for saving to disk (via QSaveFile).

Change-Id: I532aec6de7411e10e4461d5a4ac60686e2f482df
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
David Faure 2012-05-22 13:56:45 +02:00 committed by Qt by Nokia
parent 98dbaecf7f
commit e0cf8cf5f1

View File

@ -1977,7 +1977,7 @@ void QCoreApplication::setApplicationName(const QString &application)
QString QCoreApplication::applicationName()
{
QString appname = coreappdata()->application;
QString appname = coreappdata() ? coreappdata()->application : QString();
if (appname.isEmpty() && QCoreApplication::self)
appname = QCoreApplication::self->d_func()->appName();
return appname;