https://bugs.kde.org/show_bug.cgi?id=411738
--- Comment #6 from Dmitry Kazakov <dimul...@gmail.com> --- Git commit 2617900662ff7046d79249077053edc7d6942621 by Dmitry Kazakov. Committed on 24/01/2020 at 14:01. Pushed by dkazakov into branch 'master'. Fix thread-safety for rendering of the shapes Vector shapes are not thread-safe against concurrent read-writes, so we need to utilize rather complicated policy on accessing them: 1) All shape writes happen in GUI thread (right in the tools) 2) No concurrent reads from the shapes may happen in other threads while the user is modifying them. That is why our shape rendering code is split into two parts: 1) First we just fetch a shallow copy of the shapes of the layer (it takes about 1ms for complicated vecotor layers) and pack them into KoShapeManager::PaintJobsList jobs. It happens here, in slotStartAsyncRepaint(), which runs in the GUI thread. It guarantees that noone is accessing the shapes during the copy operation. 2) The rendering itself happens in the worker thread in repaint(). But repaint() doesn't access original shapes anymore. It accesses only they shallow copies, which means that there is no concurrent access to anything (*). (*) "no concurrent access to anything" is a rather fragile term :) There will still be concurrent access to it, on detaching... But(!), when detaching, the original data is kept unchanged, so "it should be safe enough"(c). Especially if we guarantee that rendering thread may not cause a detach (?), and the detach can happen only from a single GUI thread. M +19 -0 libs/flake/KoShape.cpp M +1 -1 libs/flake/KoShape.h M +66 -5 libs/flake/KoShapeManager.cpp M +53 -0 libs/flake/KoShapeManager.h M +15 -0 libs/image/krita_utils.cpp M +1 -0 libs/image/krita_utils.h M +105 -50 libs/ui/flake/kis_shape_layer_canvas.cpp M +1 -0 libs/ui/flake/kis_shape_layer_canvas.h https://invent.kde.org/kde/krita/commit/2617900662ff7046d79249077053edc7d6942621 -- You are receiving this mail because: You are watching all bug changes.