Make sure that TestGui doesn't leave a temp file behind.

Swap the parent/child relationship between QTemporaryFile and Config
because the QTemporaryFile dtor is called before its chidren are destroyed.
This commit is contained in:
Felix Geyer 2012-10-28 18:07:23 +01:00
parent 58b6fb36f8
commit d7cbec1a02

View File

@ -108,9 +108,10 @@ Config* Config::instance()
void Config::createTempFileInstance()
{
Q_ASSERT(!m_instance);
QTemporaryFile* tmpFile = new QTemporaryFile(qApp);
QTemporaryFile* tmpFile = new QTemporaryFile();
bool openResult = tmpFile->open();
Q_ASSERT(openResult);
Q_UNUSED(openResult);
m_instance = new Config(tmpFile->fileName(), tmpFile);
m_instance = new Config(tmpFile->fileName(), qApp);
tmpFile->setParent(m_instance);
}