Updater: Fix crash on exit

Make sure we wait for the updater thread before deleting the
object.

Change-Id: I1bcc2c7d7f4567a3bd1bad393e039ee0e45a24ec
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Kai Koehne
2013-12-11 15:17:22 +01:00
parent 410ae45c56
commit 48fd9d60b6

View File

@@ -91,6 +91,9 @@ UpdateInfoPlugin::UpdateInfoPlugin()
UpdateInfoPlugin::~UpdateInfoPlugin()
{
d->lastCheckUpdateInfoTask.cancel();
d->lastCheckUpdateInfoTask.waitForFinished();
delete d;
}
@@ -230,7 +233,14 @@ QDomDocument UpdateInfoPlugin::update()
// start
QProcess updater;
updater.start(d->updaterProgram, QStringList() << d->updaterCheckOnlyArgument);
updater.waitForFinished();
while (updater.state() != QProcess::NotRunning) {
if (!updater.waitForFinished(1000)
&& d->lastCheckUpdateInfoTask.isCanceled()) {
updater.kill();
updater.waitForFinished(-1);
return QDomDocument();
}
}
// process return value
QDomDocument updates;