Commit d3c5a3f6 authored by Anna Medonosová's avatar Anna Medonosová

Do not process user input during saving operations

Fixes a race condition in the saving process, which is caused by
processing user input events in multiple places during save.

BUG: 409395
parent b9671ace
......@@ -442,7 +442,7 @@ public:
if (!m_locked) {
m_image->requestStrokeEnd();
QApplication::processEvents();
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
// one more try...
m_locked = std::try_lock(m_imageLock, m_savingLock) < 0;
......@@ -777,7 +777,7 @@ void KisDocument::setFileBatchMode(const bool batchMode)
KisDocument* KisDocument::lockAndCloneForSaving()
{
// force update of all the asynchronous nodes before cloning
QApplication::processEvents();
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
KisLayerUtils::forceAllDelayedNodesUpdate(d->image->root());
KisMainWindow *window = KisPart::instance()->currentMainwindow();
......
......@@ -94,7 +94,7 @@ void KisDelayedSaveDialog::blockIfImageIsBusy()
t.start();
while (t.elapsed() < m_d->busyWait) {
QApplication::processEvents();
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
if (m_d->checkImageIdle()) {
setResult(Accepted);
......
......@@ -52,7 +52,7 @@ T runActionImpl(std::function<T()> func)
watcher.setFuture(result);
while (watcher.isRunning()) {
qApp->processEvents();
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
}
watcher.waitForFinished();
......@@ -71,7 +71,7 @@ void KisAsyncActionFeedback::runVoidAction(std::function<void()> func)
watcher.setFuture(result);
while (watcher.isRunning()) {
qApp->processEvents();
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
}
watcher.waitForFinished();
......@@ -80,7 +80,7 @@ void KisAsyncActionFeedback::runVoidAction(std::function<void()> func)
void KisAsyncActionFeedback::waitForMutex(QMutex *mutex)
{
while (!mutex->tryLock()) {
qApp->processEvents();
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
}
mutex->unlock();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment