[gimp] plug-ins: fix crash in blur-gauss-selective.c



commit e3b24af3d06f6a77372c330f371afaae1979d3ac
Author: Michael Natterer <mitch gimp org>
Date:   Thu Oct 8 12:15:06 2015 +0200

    plug-ins: fix crash in blur-gauss-selective.c
    
    Must not call the deprecated gimp_drawable_preview_get_drawable() on a
    preview that was not also created using the deprecated
    gimp_drawable_preview_new(). Instead, pass the GimpDrawable to
    preview_update() using the signal's user_data.

 plug-ins/common/blur-gauss-selective.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/plug-ins/common/blur-gauss-selective.c b/plug-ins/common/blur-gauss-selective.c
index e136605..5cf48b7 100644
--- a/plug-ins/common/blur-gauss-selective.c
+++ b/plug-ins/common/blur-gauss-selective.c
@@ -69,7 +69,8 @@ static void      sel_gauss        (GimpDrawable     *drawable,
                                    gdouble           radius,
                                    gint              maxdelta);
 static gboolean  sel_gauss_dialog (GimpDrawable     *drawable);
-static void      preview_update   (GimpPreview      *preview);
+static void      preview_update   (GimpPreview      *preview,
+                                   GimpDrawable     *drawable);
 
 
 const GimpPlugInInfo PLUG_IN_INFO =
@@ -257,7 +258,7 @@ sel_gauss_dialog (GimpDrawable *drawable)
 
   g_signal_connect (preview, "invalidated",
                     G_CALLBACK (preview_update),
-                    NULL);
+                    drawable);
 
   table = gtk_table_new (2, 3, FALSE);
   gtk_table_set_col_spacings (GTK_TABLE (table), 6);
@@ -789,9 +790,9 @@ sel_gauss (GimpDrawable *drawable,
 }
 
 static void
-preview_update (GimpPreview *preview)
+preview_update (GimpPreview  *preview,
+                GimpDrawable *drawable)
 {
-  GimpDrawable  *drawable;
   glong          bytes;
   gint           x, y;
   guchar        *render_buffer;  /* Buffer to hold rendered image */
@@ -806,8 +807,6 @@ preview_update (GimpPreview *preview)
   gdouble       radius;
 
   /* Get drawable info */
-  drawable =
-    gimp_drawable_preview_get_drawable (GIMP_DRAWABLE_PREVIEW (preview));
   bytes = drawable->bpp;
 
   /*


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