[gimp] Bug 796153 - Airbrush doesn't paint on timeout, and crashes with dynamics



commit 23dab4311abe94504d09cf3c7939a6340eb9e991
Author: Ell <ell_se yahoo com>
Date:   Wed May 16 14:29:47 2018 -0400

    Bug 796153 - Airbrush doesn't paint on timeout, and crashes with dynamics
    
    gimp_airbrush_stamp(), which is called during the airbrush timeout
    to periodically stamp the airbrush, assumes the saved symmetry's
    origin is the same as during the original call to
    gimp_airbrush_paint().  However, since commit
    bc09c718186de42795b7cd9562766c5dc01cbe5e, we clear the symmetry's
    origin at the end of gimp_paint_core_paint(), resulting in an empty
    symmetry with a NULL origin during gimp_airbrush_stamp().  As a
    result, no dab is painted, and we segfault if there's active
    dynamics.
    
    Fix this by saving the symmetry's origin coords during
    gimp_airbrush_paint(), and restoring them in gimp_airbrush_stamp().

 app/paint/gimpairbrush.c |    7 +++++++
 app/paint/gimpairbrush.h |    1 +
 2 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/app/paint/gimpairbrush.c b/app/paint/gimpairbrush.c
index c30cc24..67df7d0 100644
--- a/app/paint/gimpairbrush.c
+++ b/app/paint/gimpairbrush.c
@@ -170,6 +170,8 @@ gimp_airbrush_paint (GimpPaintCore    *paint_core,
           /* Base our timeout on the original stroke. */
           coords = gimp_symmetry_get_origin (sym);
 
+          airbrush->coords = *coords;
+
           dynamic_rate = gimp_dynamics_get_linear_value (dynamics,
                                                          GIMP_DYNAMICS_OUTPUT_RATE,
                                                          coords,
@@ -246,9 +248,14 @@ gimp_airbrush_stamp (GimpAirbrush *airbrush)
 {
   g_return_if_fail (GIMP_IS_AIRBRUSH (airbrush));
 
+  gimp_symmetry_set_origin (airbrush->sym,
+                            airbrush->drawable, &airbrush->coords);
+
   gimp_airbrush_paint (GIMP_PAINT_CORE (airbrush),
                        airbrush->drawable,
                        airbrush->paint_options,
                        airbrush->sym,
                        GIMP_PAINT_STATE_MOTION, 0);
+
+  gimp_symmetry_clear_origin (airbrush->sym);
 }
diff --git a/app/paint/gimpairbrush.h b/app/paint/gimpairbrush.h
index 4efb8d7..576ff14 100644
--- a/app/paint/gimpairbrush.h
+++ b/app/paint/gimpairbrush.h
@@ -41,6 +41,7 @@ struct _GimpAirbrush
   GimpSymmetry     *sym;
   GimpDrawable     *drawable;
   GimpPaintOptions *paint_options;
+  GimpCoords        coords;
 };
 
 struct _GimpAirbrushClass


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]