owncloudcmd: Fix an error during update phase would not terminate

the QApplication::quit()  would be run before the exec() and would
be a noop,   and then exec would just wait forever.
This commit is contained in:
Olivier Goffart 2014-03-21 10:03:11 +01:00
parent 922e004fc6
commit 8aace3284f

View file

@ -177,7 +177,10 @@ int main(int argc, char **argv) {
SyncJournalDb db(options.source_dir); SyncJournalDb db(options.source_dir);
CSyncThread csyncthread(_csync_ctx, options.source_dir, QUrl(options.target_url).path(), &db); CSyncThread csyncthread(_csync_ctx, options.source_dir, QUrl(options.target_url).path(), &db);
QObject::connect(&csyncthread, SIGNAL(finished()), &app, SLOT(quit())); QObject::connect(&csyncthread, SIGNAL(finished()), &app, SLOT(quit()));
csyncthread.startSync();
// Have to be done async, else, an error while updating does not terminate the event loop.
QMetaObject::invokeMethod(&csyncthread, "startSync", Qt::QueuedConnection);
app.exec(); app.exec();