Bug 795257 - Segmentation fault crash using the clone tool

Desktop / GNOME / GIMP - Ell [yahoo.com] - 14 April 2018 14:14 UTC

Commit f5cb1fed85341a9d0a46fb1391b19fa9ea3ccb42, which performed brush outline generation in GimpPaintTool in synchrony with the paint thread, wasn't enough, since GimpSourceTool could still call gimp_brush_tool_create_outline() directly during its GimpDrawTool::draw() method, leading to the same race condition when executed concurrently with the paint thread.

Partially revert the above commit, so that outline generation is handled as before, as far as GimpPaintTool is concenered. Instead, add GimpPaintTool::{start,end,flush}_paint() virtual functions; the first two are called when starting/ending painting using the paint thread, while the third is called during the display-update timeout, while the main thread and the paint thread are synchronized. This allows subclasses to perform non-thread-safe actions while the threads are synchronized.

Override these functions in GimpBrushTool, and cache the brush boundary in the flush() function. Use the cached boundary in gimp_brush_tool_create_outline() while painting, to avoid the above race condition, both when this function is called through GimpPaintTool, and through GimpSourceTool.

45c172a885 Bug 795257 - Segmentation fault crash using the clone tool
app/tools/gimpbrushtool.c | 109 +++++++++++++++++++++++++++++++++-------
app/tools/gimpbrushtool.h | 6 ++-
app/tools/gimppainttool-paint.c | 60 +++++++---------------
app/tools/gimppainttool.c | 34 ++++++-------
app/tools/gimppainttool.h | 58 +++++++++++----------
5 files changed, 160 insertions(+), 107 deletions(-)

Upstream: git.gnome.org

  • Share