Bug 328617

Summary: Pressing Insert or Backspace while doing a stroke hangs Krita
Product: [Applications] krita Reporter: Dmitry Kazakov <dimula73>
Component: ToolsAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: patch

Description Dmitry Kazakov 2013-12-10 10:07:09 UTC
subj
Comment 1 Anton Saraev 2013-12-12 11:57:32 UTC
Created attachment 84058 [details]
patch

I'm not sure that correctly understood the problem. In my case, krita freezes if press "Insert" while painting with "paint with brushes" tool. With Backspace key all is normal.
Problem in invocation of barrierLock method for image (image/kis_legacy_undo_adapter.cpp:50) while endStroke (image/kis_update_sheduler.cpp:189) is not invoked. As result: infinite loop in sheduler's barrierLock method (:252).
With Backspace there is no problem, because Backspace's handler has code looks like in the patch (ui/actions/kis_selection_action_factories.cpp:150).
Assert added because it exists in invoked method (ui/kis_layer_manager.cc : 489)
Maybe this code must be in some child's invocation, but so far I think this is the right place.
p.s. Sorry if I'm too verbose.
Comment 2 Dmitry Kazakov 2013-12-12 14:55:31 UTC
Hi, Anton!

Thank you for the patch! It is better to use activeNode->systemLocked() here, because hasEditablePaintDevice() also checks the existence of the paint device in the node, which is not always the case. For example the Shape Layer doesn't have one, so one will not be able to add a layer, when a shape layer is activated :)

Actually, the real problem of this hang-up is a bit more deep: the actions in the node manager are not yet ported to Strokes System, so they cannot be run asynchronously. They still use KisLegacyUndoAdapter, which, yes, calls barrierLock(). Ideally, the methods of KisNodeManager, KisLayerManager and KisMaskManager should not use the legacy stuff, but work with KisProcessingApplicator instead (which would run everything asyncronously).

But this "ideal" solution would demand a bit of refactoring in the managers classes. Someone could do it as a junior job :)

For now I will just push your patch, a bit changed to comply with systemLocked().
Comment 3 Dmitry Kazakov 2013-12-12 15:04:31 UTC
Git commit 600207687b3eb71c705c8e07599b29354679b16b by Dmitry Kazakov.
Committed on 12/12/2013 at 15:03.
Pushed by dkazakov into branch 'master'.

Fix the hang-up in the legacy node-editing actions

Special thanks to Anton Saraev for preparing initial patch for the bug!

Node Manager is one of few places in Krita which are not ported to
strokes yet and continues to use KisLegacyUndoAdapter. Ideally its
actions should run asynchronously using KisProcessingsApplicator,
but for now we will just check whether the node is locked or not.

M  +5    -0    krita/ui/kis_node_manager.cpp

http://commits.kde.org/calligra/600207687b3eb71c705c8e07599b29354679b16b
Comment 4 Dmitry Kazakov 2013-12-12 15:05:11 UTC
Git commit 1f1d05016b9d5f6ae778778c875081b40fd7ff11 by Dmitry Kazakov.
Committed on 12/12/2013 at 15:03.
Pushed by dkazakov into branch 'calligra/2.8'.

Fix the hang-up in the legacy node-editing actions

Special thanks to Anton Saraev for preparing initial patch for the bug!

Node Manager is one of few places in Krita which are not ported to
strokes yet and continues to use KisLegacyUndoAdapter. Ideally its
actions should run asynchronously using KisProcessingsApplicator,
but for now we will just check whether the node is locked or not.

M  +5    -0    krita/ui/kis_node_manager.cpp

http://commits.kde.org/calligra/1f1d05016b9d5f6ae778778c875081b40fd7ff11