Bug 409968

Summary: Text tool gives abort message pop up when trying to edit existing text
Product: [Applications] krita Reporter: Toby <tobywillsmer>
Component: Tool/TextAssignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: crash CC: abscondingtiger, andrew.mcgraw02, arabam077, ghevan, grapelordo, griffinvalley, halla, jonathan.l.copeland, katearcher89, princeton.to, tamtamy.tymona, theslider2
Priority: NOR    
Version: 4.2.3   
Target Milestone: ---   
Platform: Ubuntu   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Attachments: Screenshot with abort popup
try to save file after pop up has been dismissed
gdb log of session leading to assert.

Description Toby 2019-07-18 21:16:16 UTC
Created attachment 121617 [details]
Screenshot with abort popup

SUMMARY


STEPS TO REPRODUCE
1. open an existing file or make a new one
2. click the text tool 'T' in the toolbar
3. enter some text in the pop up box, click save then click close
4. click the text tool 'T' in the toolbar
5. now go to try and edit the newly added text

OBSERVED RESULT
the text pop up appears along with an error message pop up saying abort or ignore. Clicking abort closes Krita and ignore does just that but every time you try to edit text this pop up message appears

Krita has encountered an internal error:

SAFE ASSERT (krita): "!m_d->readyShortcut" in file /home/appimage/workspace/Krita_Release_Appimage_Build/krita/libs/ui/input/kis_shortcut_matcher.cpp, line 579

Please report a bug to developers!

Press Ignore to try to continue.
Press Abort to see developers information (all unsaved data will be lost)


EXPECTED RESULT
should be able to edit and save text with no error message pop up

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Ubuntu 18.0.4.2
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Halla Rempt 2019-07-19 07:17:10 UTC
Can you consistently reproduce the issue with those steps? I am not getting that warning.
Comment 2 Toby 2019-07-19 23:30:12 UTC
(In reply to Boudewijn Rempt from comment #1)
> Can you consistently reproduce the issue with those steps? I am not getting
> that warning.

Yes, it happens every time. It doesn't happen in 4.2.2. I also downloaded a fresh version of 4.2.3 to see if it was that and yep it did the same error.
Comment 3 Halla Rempt 2019-07-20 07:30:15 UTC
Hm, the difference between 4.2.2 and 4.2.3 is that we enabled those message boxes, instead of silently ignorning the warnings. I still don't get the message box myself, though. What happens if you press ignore?
Comment 4 Tiar 2019-07-20 20:49:28 UTC
When I pressed Ignore, it appeared right afterwards again - maybe after one more action, and it didn't have an end - Krita had to be restarted (I *guess* there was an possibility to save the image, but since those error messages was really disrupting and happens one after another, it is possible that the user may not be able to do so).
Comment 5 Tiar 2019-07-20 20:51:43 UTC
*** Bug 410048 has been marked as a duplicate of this bug. ***
Comment 6 Toby 2019-07-20 23:16:47 UTC
(In reply to Tymond from comment #4)
> When I pressed Ignore, it appeared right afterwards again - maybe after one
> more action, and it didn't have an end - Krita had to be restarted (I
> *guess* there was an possibility to save the image, but since those error
> messages was really disrupting and happens one after another, it is possible
> that the user may not be able to do so).

Yes I get the same, if I click 'ignore'the message goes away but then if I click anything it comes back, this then happens all the time until I close Krita and reopen it. 
If I dismiss the pop up and then click 'File' to try to save the image I get 2 popups with the same message (attached screenshot)
Comment 7 Toby 2019-07-20 23:18:03 UTC
Created attachment 121652 [details]
try to save file after pop up has been dismissed
Comment 8 Andrew 2019-07-21 22:36:01 UTC
The same thing happened to me yesterday. I was just using the perspective tool on a text box and after maybe 20 seconds I got the same error.
Comment 9 vanyossi 2019-07-22 03:08:04 UTC
Created attachment 121670 [details]
gdb log of session leading to assert.

I can consistently recreate the assert following the steps given

Kubuntu: 18.04 bionic
krita 4.2.3

After the assert is trown, ignore will recover control of mouse but every event action will trigger the assert again. It is not possible to paint at all after this (events are locked).

I attach the gdb log of the run that led to the assert (not a lot of info but it may be useful).

The bug cannot be replicated in macOS
Comment 10 vanyossi 2019-07-22 03:13:57 UTC
*** Bug 410053 has been marked as a duplicate of this bug. ***
Comment 11 theslider2 2019-07-25 20:29:45 UTC
I get the same error on Windows 10 on the latest Krita version. I can't work with this any more so I'm reverting back to the previous version.
Comment 12 wolthera 2019-07-28 11:27:59 UTC
*** Bug 410299 has been marked as a duplicate of this bug. ***
Comment 13 Halla Rempt 2019-07-29 09:52:24 UTC
*** Bug 410329 has been marked as a duplicate of this bug. ***
Comment 15 Halla Rempt 2019-07-30 08:38:52 UTC
*** Bug 410317 has been marked as a duplicate of this bug. ***
Comment 16 Dmitry Kazakov 2019-07-30 15:32:05 UTC
Git commit b8870d02392a65ee5b4607a3df8bf0f7da363f08 by Dmitry Kazakov.
Committed on 30/07/2019 at 14:16.
Pushed by dkazakov into branch 'master'.

Make KisShortcutMatcher be more tolerant to recursive entering

Some tools, e.g. text tool, may open a dialog right inside
beginPrimaryAction() callback. It may make KisShortcutMatcher crazy,
because all the modal dialogs have hey own event loop, therefore
the state machine of the shortcuts matcher will be broken.

This patch makes the matcher a bit more tolerant to such faults. It
just manually checks if it is entered more that once, and resets the
action in case a recursion is detected.
Related: bug 408826, bug 409275

M  +168  -30   libs/ui/input/kis_shortcut_matcher.cpp
M  +1    -0    libs/ui/input/kis_shortcut_matcher.h

https://invent.kde.org/kde/krita/commit/b8870d02392a65ee5b4607a3df8bf0f7da363f08
Comment 17 Dmitry Kazakov 2019-07-30 15:32:05 UTC
Git commit 008503fb5c5590cfe74c73c1e1a76b26a944e309 by Dmitry Kazakov.
Committed on 30/07/2019 at 14:16.
Pushed by dkazakov into branch 'master'.

Make shape painting tools unblocking (use strokes)

Opening a waiting dialog may make the shortcuts matcher unhappy,
so we should avoid that.
Related: bug 408826, bug 409275

M  +3    -4    libs/ui/tool/kis_tool_shape.cc
M  +1    -2    plugins/tools/basictools/kis_tool_ellipse.cc
M  +42   -25   plugins/tools/basictools/kis_tool_gradient.cc
M  +1    -3    plugins/tools/basictools/kis_tool_rectangle.cc
M  +0    -2    plugins/tools/tool_polygon/kis_tool_polygon.cc
M  +0    -3    plugins/tools/tool_polyline/kis_tool_polyline.cc

https://invent.kde.org/kde/krita/commit/008503fb5c5590cfe74c73c1e1a76b26a944e309
Comment 18 Dmitry Kazakov 2019-07-30 15:35:13 UTC
*** Bug 410045 has been marked as a duplicate of this bug. ***
Comment 19 Halla Rempt 2019-07-31 08:42:11 UTC
Git commit df7f7a9ac7e49a44ef83062c19a3d62510a0ad49 by Boudewijn Rempt, on behalf of Dmitry Kazakov.
Committed on 31/07/2019 at 08:39.
Pushed by rempt into branch 'krita/4.2'.

Make shape painting tools unblocking (use strokes)

Opening a waiting dialog may make the shortcuts matcher unhappy,
so we should avoid that.
Related: bug 408826, bug 409275

M  +3    -4    libs/ui/tool/kis_tool_shape.cc
M  +1    -2    plugins/tools/basictools/kis_tool_ellipse.cc
M  +42   -25   plugins/tools/basictools/kis_tool_gradient.cc
M  +1    -3    plugins/tools/basictools/kis_tool_rectangle.cc
M  +0    -2    plugins/tools/tool_polygon/kis_tool_polygon.cc
M  +0    -3    plugins/tools/tool_polyline/kis_tool_polyline.cc

https://invent.kde.org/kde/krita/commit/df7f7a9ac7e49a44ef83062c19a3d62510a0ad49
Comment 20 Halla Rempt 2019-07-31 08:42:12 UTC
Git commit dc6bf17a96556c930f63e4cfbd42591f79987573 by Boudewijn Rempt, on behalf of Dmitry Kazakov.
Committed on 31/07/2019 at 08:39.
Pushed by rempt into branch 'krita/4.2'.

Make KisShortcutMatcher be more tolerant to recursive entering

Some tools, e.g. text tool, may open a dialog right inside
beginPrimaryAction() callback. It may make KisShortcutMatcher crazy,
because all the modal dialogs have hey own event loop, therefore
the state machine of the shortcuts matcher will be broken.

This patch makes the matcher a bit more tolerant to such faults. It
just manually checks if it is entered more that once, and resets the
action in case a recursion is detected.
Related: bug 408826, bug 409275

M  +168  -30   libs/ui/input/kis_shortcut_matcher.cpp
M  +1    -0    libs/ui/input/kis_shortcut_matcher.h

https://invent.kde.org/kde/krita/commit/dc6bf17a96556c930f63e4cfbd42591f79987573