Skip to content
  • Ell's avatar
    Bug 795257 - Segmentation fault crash using the clone tool · 45c172a8
    Ell authored
    Commit f5cb1fed, 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.
    45c172a8