kdecore: process all events while waiting for job to finish in KJob::exec()

fixes hang in case the job progress is not hidden and UI events have to be processed

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-05-26 07:26:56 +03:00
parent 738b4caea0
commit f53dc16596
2 changed files with 1 additions and 7 deletions

View file

@ -196,7 +196,7 @@ bool KJob::exec()
start();
while( !d->isFinished ) {
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
QCoreApplication::processEvents();
}
return ( d->error == NoError );
}

View file

@ -243,12 +243,6 @@ public:
* You should avoid calling exec() whenever you can and use the asynchronous interface of KJob
* instead.
*
* Note that user input events will not be processed while the job is being executed, which
* means your user interface will effectivly be blocked. Other events like paint or network
* events are still being processed. The advantage of not processing user input events is that
* the chance of accidental reentrancy is greatly reduced. Still you should avoid calling this
* function.
*
* Another thing to note is that the result of the job will be emited after the execution
* finishes.
*