Summary: | Crash in undo stack when doing undo | ||
---|---|---|---|
Product: | [Applications] krita | Reporter: | acc4commissions |
Component: | General | Assignee: | Dmitry Kazakov <dimula73> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | halla |
Priority: | NOR | Keywords: | release_blocker |
Version: | nightly build (please specify the git hash!) | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | All | ||
Latest Commit: | https://invent.kde.org/graphics/krita/commit/75393eba4070e225f26d9f4afdbd7d6241960d5a | Version Fixed In: |
Description
acc4commissions
2022-07-08 05:12:35 UTC
I'm on Win10, using OpenGL renderer. According to the stack trace the crash happens in KUndo2QStack::undo(), at line 962. The result returned by `m_command_list.at(idx)` is null. I have no idia why though. Hi, acc4commissions! Can you reproduce this crash somehow? Or does it crash regularly? The point is, I can see where it happens, but I cannot understand how this situation can happen. If you could reproduce the issue, I could make you a special build with sanity checks. It would bring more light on the issue. (In reply to Dmitry Kazakov from comment #3) > Hi, acc4commissions! > > Can you reproduce this crash somehow? Or does it crash regularly? > > The point is, I can see where it happens, but I cannot understand how this > situation can happen. If you could reproduce the issue, I could make you a > special build with sanity checks. It would bring more light on the issue. Nope, I only came across this crash once so far and haven't ben able to reproduce again since. sorry... I'll post it here when the similar crash happens again. *** Bug 457463 has been marked as a duplicate of this bug. *** Hi, @acc4commissions! If you have time, could you please try to reproduce the issue with the following package: https://krita-artists.org/t/testing-krita-5-1-0-beta-1-2-issue-found/43375/15?u=dkazakov Be careful, it is significantly slower than normal Krita :( *** Bug 457527 has been marked as a duplicate of this bug. *** Hi, acc4commissions! Just in case you encounter this crash again, please report it anyway. Either as a separate bug (which I will merge later) or just as a comment into this bug. I will need a backtrace and what you did before it happened. I still have troubles understanding how this crash happens, so any information will be valuable. This bug is the only release blocker for 5.1 now :) Hi, acc4commissions! Could you please test this package for the presence of this crash? It is a snapshot of the current master and it is AS FAST AS NORMAL KRITA. The only difference with master is that it will silently crash as soon as encounters one specific (in my opinion impossible) state. So please set autosave interval low :) https://disk.yandex.ru/d/smkw3FqzCJ_1lA If you manage to crash Krita with this package, please attach the crash log. It will be unusual and very detailed. Hi, @acc4commissions! Here is an updated package: https://krita-artists.org/t/testing-krita-5-1-0-beta-1-2-issue-found/43375/27?u=dkazakov Git commit 2898ffe4ab4dfaf1ddf810fe04f1209624b7eb4c by Dmitry Kazakov. Committed on 11/08/2022 at 13:43. Pushed by dkazakov into branch 'master'. Fix a crash in undo stask The crash happened between the consurrent access to the stack from two actors: 1) One stroke adding its command to the undo stack and calling KUndo2QStack::checkUndoLimit() to purge the oldest command of the stack to satisfy the undo stack limit. 2) The user starting the new stroke, which calls KUndo2QStack::purgeRedoState() from the GUI thread in a non- synchronized way. Obviously, the crash happens only when the undo stack limit is reached. Otherwise both the functions do nothing and no crash happens. The fix of the bug just moves the call to purgeRedoState() from the point when a stroke is added into the queue to a point when the stroke is actually started by the queue. Huge thanks to @mako and @acc4 from Krita Artists for their help with testing all my packages and tracking the crash down :) M +5 -10 libs/image/kis_image.cc M +5 -0 libs/image/kis_stroke.cpp M +1 -0 libs/image/kis_stroke.h M +29 -8 libs/image/kis_strokes_queue.cpp M +1 -0 libs/image/kis_strokes_queue.h M +5 -0 libs/image/kis_update_scheduler.cpp M +7 -0 libs/image/kis_update_scheduler.h https://invent.kde.org/graphics/krita/commit/2898ffe4ab4dfaf1ddf810fe04f1209624b7eb4c Git commit 75393eba4070e225f26d9f4afdbd7d6241960d5a by Dmitry Kazakov. Committed on 11/08/2022 at 13:44. Pushed by dkazakov into branch 'krita/5.1'. Fix a crash in undo stask The crash happened between the consurrent access to the stack from two actors: 1) One stroke adding its command to the undo stack and calling KUndo2QStack::checkUndoLimit() to purge the oldest command of the stack to satisfy the undo stack limit. 2) The user starting the new stroke, which calls KUndo2QStack::purgeRedoState() from the GUI thread in a non- synchronized way. Obviously, the crash happens only when the undo stack limit is reached. Otherwise both the functions do nothing and no crash happens. The fix of the bug just moves the call to purgeRedoState() from the point when a stroke is added into the queue to a point when the stroke is actually started by the queue. Huge thanks to @mako and @acc4 from Krita Artists for their help with testing all my packages and tracking the crash down :) M +5 -10 libs/image/kis_image.cc M +5 -0 libs/image/kis_stroke.cpp M +1 -0 libs/image/kis_stroke.h M +29 -8 libs/image/kis_strokes_queue.cpp M +1 -0 libs/image/kis_strokes_queue.h M +5 -0 libs/image/kis_update_scheduler.cpp M +7 -0 libs/image/kis_update_scheduler.h https://invent.kde.org/graphics/krita/commit/75393eba4070e225f26d9f4afdbd7d6241960d5a Git commit 7e4636c75cef792aca69f8ff1b60f2c4d049de7d by Dmitry Kazakov. Committed on 12/08/2022 at 07:17. Pushed by dkazakov into branch 'master'. Fix a possible race condition when in vector/reference operations When we add stuff to the undo stack the image should be locked to avoid any threading issues. M +0 -16 libs/ui/KisDocument.cpp M +0 -19 libs/ui/KisDocument.h M +2 -3 libs/ui/KisReferenceImagesDecoration.cpp M +1 -1 libs/ui/actions/KisPasteActionFactories.cpp M +1 -1 libs/ui/canvas/kis_canvas2.cpp M +1 -1 libs/ui/canvas/kis_guides_manager.cpp M +3 -3 libs/ui/kis_document_undo_store.cpp M +3 -6 plugins/tools/defaulttool/referenceimagestool/ToolReferenceImages.cpp https://invent.kde.org/graphics/krita/commit/7e4636c75cef792aca69f8ff1b60f2c4d049de7d Git commit 16d500f256c8d3123c95aceafefd22a2c6eed2de by Dmitry Kazakov. Committed on 12/08/2022 at 07:17. Pushed by dkazakov into branch 'krita/5.1'. Fix a possible race condition when in vector/reference operations When we add stuff to the undo stack the image should be locked to avoid any threading issues. M +0 -16 libs/ui/KisDocument.cpp M +0 -19 libs/ui/KisDocument.h M +2 -3 libs/ui/KisReferenceImagesDecoration.cpp M +1 -1 libs/ui/actions/KisPasteActionFactories.cpp M +1 -1 libs/ui/canvas/kis_canvas2.cpp M +1 -1 libs/ui/canvas/kis_guides_manager.cpp M +3 -3 libs/ui/kis_document_undo_store.cpp M +3 -6 plugins/tools/defaulttool/referenceimagestool/ToolReferenceImages.cpp https://invent.kde.org/graphics/krita/commit/16d500f256c8d3123c95aceafefd22a2c6eed2de Git commit be648b265d825405a5de5219813fae9b73524e4e by Dmitry Kazakov. Committed on 12/08/2022 at 14:25. Pushed by dkazakov into branch 'master'. Make sure that suspend stroke does not reset redo state M +1 -0 libs/image/kis_suspend_projection_updates_stroke_strategy.cpp https://invent.kde.org/graphics/krita/commit/be648b265d825405a5de5219813fae9b73524e4e Git commit 23e186e2d6fdaa426d8ee6f2c7e731efe9f24973 by Dmitry Kazakov. Committed on 12/08/2022 at 14:26. Pushed by dkazakov into branch 'krita/5.1'. Make sure that suspend stroke does not reset redo state M +1 -0 libs/image/kis_suspend_projection_updates_stroke_strategy.cpp https://invent.kde.org/graphics/krita/commit/23e186e2d6fdaa426d8ee6f2c7e731efe9f24973 |