[gimp] Bug 757773 - Filters->Edge Detect->Neon... crashes



commit 4446954e277d030a13392628d9ba804da8b82e75
Author: Michael Natterer <mitch gimp org>
Date:   Sun Nov 8 14:15:44 2015 +0100

    Bug 757773 - Filters->Edge Detect->Neon... crashes
    
    As in e3b24af3d06f6a77372c330f371afaae1979d3ac, don't use a
    GimpDrawablePreview's GimpDrawable if it was not created using the
    deprecated GimpDrawabl-based API. Spotted by Massimo.

 plug-ins/common/edge-neon.c    |   10 ++++++----
 plug-ins/common/sharpen.c      |   12 +++++-------
 plug-ins/common/unsharp-mask.c |   12 +++++-------
 3 files changed, 16 insertions(+), 18 deletions(-)
---
diff --git a/plug-ins/common/edge-neon.c b/plug-ins/common/edge-neon.c
index 007e675..f5aeab4 100644
--- a/plug-ins/common/edge-neon.c
+++ b/plug-ins/common/edge-neon.c
@@ -65,7 +65,8 @@ static void      neon                (GimpDrawable     *drawable,
                                       GimpPreview      *preview);
 
 static gboolean  neon_dialog         (GimpDrawable     *drawable);
-static void      neon_preview_update (GimpPreview      *preview);
+static void      neon_preview_update (GimpPreview      *preview,
+                                      GimpDrawable     *drawable);
 
 /*
  * Gaussian operator helper functions
@@ -722,7 +723,7 @@ neon_dialog (GimpDrawable *drawable)
 
   g_signal_connect (preview, "invalidated",
                     G_CALLBACK (neon_preview_update),
-                    NULL);
+                    drawable);
 
   table = gtk_table_new (2, 3, FALSE);
   gtk_table_set_col_spacings (GTK_TABLE (table), 6);
@@ -769,9 +770,10 @@ neon_dialog (GimpDrawable *drawable)
 }
 
 static void
-neon_preview_update (GimpPreview *preview)
+neon_preview_update (GimpPreview  *preview,
+                     GimpDrawable *drawable)
 {
-  neon (GIMP_DRAWABLE_PREVIEW (preview)->drawable,
+  neon (drawable,
         evals.radius,
         evals.amount,
         preview);
diff --git a/plug-ins/common/sharpen.c b/plug-ins/common/sharpen.c
index dbeac7c..9a08e35 100644
--- a/plug-ins/common/sharpen.c
+++ b/plug-ins/common/sharpen.c
@@ -53,7 +53,8 @@ static void     sharpen        (GimpDrawable *drawable);
 
 static gboolean sharpen_dialog (GimpDrawable *drawable);
 
-static void     preview_update (GimpPreview  *preview);
+static void     preview_update (GimpPreview  *preview,
+                                GimpDrawable *drawable);
 
 typedef gint32 intneg;
 typedef gint32 intpos;
@@ -496,7 +497,7 @@ sharpen_dialog (GimpDrawable *drawable)
 
   g_signal_connect (preview, "invalidated",
                     G_CALLBACK (preview_update),
-                    NULL);
+                    drawable);
 
   table = gtk_table_new (1, 3, FALSE);
   gtk_table_set_col_spacings (GTK_TABLE (table), 6);
@@ -526,9 +527,9 @@ sharpen_dialog (GimpDrawable *drawable)
 }
 
 static void
-preview_update (GimpPreview *preview)
+preview_update (GimpPreview  *preview,
+                GimpDrawable *drawable)
 {
-  GimpDrawable *drawable;
   GimpPixelRgn  src_rgn;        /* Source image region */
   guchar       *src_ptr;        /* Current source pixel */
   guchar       *dst_ptr;        /* Current destination pixel */
@@ -551,9 +552,6 @@ preview_update (GimpPreview *preview)
   gimp_preview_get_position (preview, &x1, &y1);
   gimp_preview_get_size (preview, &preview_width, &preview_height);
 
-  drawable =
-    gimp_drawable_preview_get_drawable (GIMP_DRAWABLE_PREVIEW (preview));
-
   img_bpp = gimp_drawable_bpp (drawable->drawable_id);
 
 
diff --git a/plug-ins/common/unsharp-mask.c b/plug-ins/common/unsharp-mask.c
index ee83e27..9620735 100644
--- a/plug-ins/common/unsharp-mask.c
+++ b/plug-ins/common/unsharp-mask.c
@@ -91,7 +91,8 @@ static void      unsharp_mask        (GimpDrawable   *drawable,
                                       gdouble         amount);
 
 static gboolean  unsharp_mask_dialog (GimpDrawable   *drawable);
-static void      preview_update      (GimpPreview    *preview);
+static void      preview_update      (GimpPreview    *preview,
+                                      GimpDrawable   *drawable);
 
 
 /* create a few globals, set default values */
@@ -859,7 +860,7 @@ unsharp_mask_dialog (GimpDrawable *drawable)
 
   g_signal_connect (preview, "invalidated",
                     G_CALLBACK (preview_update),
-                    NULL);
+                    drawable);
 
   table = gtk_table_new (3, 3, FALSE);
   gtk_table_set_col_spacings (GTK_TABLE (table), 6);
@@ -917,9 +918,9 @@ unsharp_mask_dialog (GimpDrawable *drawable)
 }
 
 static void
-preview_update (GimpPreview *preview)
+preview_update (GimpPreview  *preview,
+                GimpDrawable *drawable)
 {
-  GimpDrawable *drawable;
   gint          x1, x2;
   gint          y1, y2;
   gint          x, y;
@@ -928,9 +929,6 @@ preview_update (GimpPreview *preview)
   GimpPixelRgn  srcPR;
   GimpPixelRgn  destPR;
 
-  drawable =
-    gimp_drawable_preview_get_drawable (GIMP_DRAWABLE_PREVIEW (preview));
-
   gimp_pixel_rgn_init (&srcPR, drawable,
                        0, 0, drawable->width, drawable->height, FALSE, FALSE);
   gimp_pixel_rgn_init (&destPR, drawable,


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