https://bugs.kde.org/show_bug.cgi?id=460461

--- Comment #5 from Dmitry Kazakov <dimul...@gmail.com> ---
Git commit 0641f768bd3d4a712f465a32a3cf4304457f66cb by Dmitry Kazakov.
Committed on 28/10/2022 at 06:20.
Pushed by dkazakov into branch 'krita/5.1'.

Possible fix for the artifacts when using the line tool

There was a theoretical race condition possible in
KisAsyncMerger::setupProjection:

Preconditions:

1) The image has only one layer with fully transparent default pixel
   (to trigget tryOblidgeChild mechanism)

Mecanics of the issue:

1) KisAsyncMerger requests currentLeaf->parent()->original(), which points
   to the projection() of the only child layer (which equals to
   its paintDevice().

2) KisAsyncMerger thread sleeps

3) Some other thread starts an indirect painting stroke over this
   layer, basically changing projection() of the layer to be separate
   from its paintDevice()

4) KisAsyncMerger thread wakes up

5) The condition `parentOriginal != currentLeaf->projection()` succeeds
   because parentOriginal still points to the layer's paintDevice

6) KisAsyncMerger starts to write into paint layer's paint device,
   which breaks its undo history.

Lots of thanks go to freyalupen for debugging this issue locally and
providing the valuable debugging info.

M  +2    -2    libs/image/kis_async_merger.cpp
M  +20   -2    libs/image/kis_group_layer.cc
M  +8    -0    libs/image/kis_group_layer.h
M  +6    -0    libs/image/kis_projection_leaf.cpp
M  +1    -0    libs/image/kis_projection_leaf.h

https://invent.kde.org/graphics/krita/commit/0641f768bd3d4a712f465a32a3cf4304457f66cb

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to