forked from qt-creator/qt-creator
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:
@@ -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;
|
||||
|
Reference in New Issue
Block a user