Bug 450151

Summary: Crash when drawing on brush editor scratchpad
Product: [Applications] krita Reporter: stephen <tgdev001>
Component: GeneralAssignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: crash CC: alvin, dimula73, halla
Priority: NOR Keywords: regression
Version First Reported In: nightly build (please specify the git hash!)   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description stephen 2022-02-13 11:40:58 UTC
Krita version : 5.1.0 pre-alpha 7f553b6

SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***

Crash after changing a few settings in the brush settings menu then drawing in scratchpad.
Also, for some reason, the brush tip is not well responsive.

STEPS TO REPRODUCE
1. reach the brush settings menu with default pixel engine brush
2. change the ratio of the brush and the size a few times
3. right after doing these, try to paint multiple strokes in the scratchpad

OBSERVED RESULT
The brush tip preview stops responding to changes suddenly.
Same as the scratchpad which stops rendering brush strokes.
You get a crash afterwards.

EXPECTED RESULT
Responsive brush tip preview and scratchpad.
No crash.

SOFTWARE/OS VERSIONS
Windows 10 21H1
Comment 1 Alvin Wong 2022-02-13 13:52:06 UTC
Crashes for me on c00ed27abe (Windows) after making a stroke on the scratchpad without even touching any brush settings. Doesn't matter if I have a document open or not.


krita.exe caused an Access Violation at location 00007FF8011C1B44 in module libkritaimage.dll Reading from location 0000000200000002.

AddrPC           Params
00007FF8011C1B44 0000000026066370 0000000000000000 00007FF8012CDCE0  libkritaimage.dll!0x221b44 KisPostExecutionUndoAdapter::addCommand+0x74
00007FF801133DA5 000000001668D3C0 00007FF8010F6015 0000000010623A40  libkritaimage.dll!0x193da5 std::_Function_handler<void (), KisIndirectPaintingSupport::mergeToLayerImpl(KisSharedPtr<KisPaintDevice>, KisPostExecutionUndoAdapter*, KUndo2MagicString const&, int, bool, QSharedPointer<KisIndirectPaintingSupport::WriteLocker>, QVector<KisRunnableStrokeJobData*>*)::{lambda()#3}>::_M_invoke+0x85
00007FF8008EBD8C 000000002493FE70 0000000000E20000 00000000116973A1  libkritaui.dll!0x21bd8c FreehandStrokeStrategy::doStrokeCallback+0x12c
00007FF8012F2A28 0000000000000010 0000000025B9EF40 000000001F68DBD0  libkritaimage.dll!0x352a28 KisUpdateJobItem::run+0xa8
00007FF802208A90 000000001F8C92B0 000000001F68DB00 0000000000000000  Qt5Core.dll!0x28a90 QThreadPool::tryStart+0x520
00007FF802201AAF 0000000000000000 0000000000000000 0000000000000000  Qt5Core.dll!0x21aaf QThread::qt_metacall+0x69f
00007FF855847034 0000000000000000 0000000000000000 0000000000000000  KERNEL32.DLL!0x17034 BaseThreadInitThunk+0x14
00007FF857782651 0000000000000000 0000000000000000 0000000000000000  ntdll.dll!0x52651 RtlUserThreadStart+0x21
Comment 2 Dmitry Kazakov 2022-02-14 07:13:48 UTC
That is a regression after my multithreaded indirect painting patch
Comment 3 Dmitry Kazakov 2022-02-17 14:37:09 UTC
Git commit 7ece5a07382b9d561d46da955fa332ecedf750c1 by Dmitry Kazakov.
Committed on 17/02/2022 at 14:36.
Pushed by dkazakov into branch 'master'.

Fix a crash when painting on the scratchpad

M  +4    -11   libs/image/kis_indirect_painting_support.cpp
M  +12   -8    libs/ui/tool/strokes/kis_painter_based_stroke_strategy.cpp
M  +9    -0    libs/ui/tool/strokes/kis_painter_based_stroke_strategy.h

https://invent.kde.org/graphics/krita/commit/7ece5a07382b9d561d46da955fa332ecedf750c1