From 165940164218d8ad10c43f39d08f0559e859098d Mon Sep 17 00:00:00 2001 From: David Capello Date: Tue, 24 Sep 2019 15:57:26 -0300 Subject: [PATCH] Fix progress bar applying filters (fix #2152) Regression introduced in 4264f199cdf398659fd90db4c572f42c47fd5988 --- src/app/ui/editor/editor.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/app/ui/editor/editor.cpp b/src/app/ui/editor/editor.cpp index 8362f917c..cbe0a9cf9 100644 --- a/src/app/ui/editor/editor.cpp +++ b/src/app/ui/editor/editor.cpp @@ -1990,9 +1990,10 @@ void Editor::onPaint(ui::PaintEvent& ev) // Editor with sprite else { try { - // Lock the sprite to read/render it. We wait 1/4 secs in case - // the background thread is making a backup. - DocReader documentReader(m_document, 250); + // Lock the sprite to read/render it. Here we don't wait if the + // document is locked (e.g. a filter is being applied to the + // sprite) to avoid locking the UI. + DocReader documentReader(m_document, 0); // Draw the sprite in the editor renderChrono.reset(); @@ -2030,8 +2031,9 @@ void Editor::onPaint(ui::PaintEvent& ev) } } catch (const LockedDocException&) { - // The sprite is locked to be read, so we can draw an opaque - // background only. + // The sprite is locked, so we cannot render it, we can draw an + // opaque background now, and defer the rendering of the sprite + // for later. g->fillRect(theme->colors.editorFace(), rc); defer_invalid_rect(g->getClipBounds().offset(bounds().origin())); }