Bug 757773 - Filters->Edge Detect->Neon... crashes

As in e3b24af3d0, don't use a
GimpDrawablePreview's GimpDrawable if it was not created using the
deprecated GimpDrawabl-based API. Spotted by Massimo.
This commit is contained in:
Michael Natterer 2015-11-08 14:15:44 +01:00
parent 990c91f2a7
commit 4446954e27
3 changed files with 16 additions and 18 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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,