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

--- Comment #3 from Dmitry Kazakov <dimul...@gmail.com> ---
Git commit 6d87f89408cec4e9b302199b888083249a934e77 by Dmitry Kazakov.
Committed on 27/10/2022 at 11:57.
Pushed by dkazakov into branch 'master'.

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/6d87f89408cec4e9b302199b888083249a934e77

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

Reply via email to