added missing call to destroy_preview(). Fixes bug #464457.

2007-08-08  Sven Neumann  <sven@gimp.org>

	* plug-ins/jpeg/jpeg-save.c (save_dialog): added missing call to
	destroy_preview(). Fixes bug #464457.

	* plug-ins/jpeg/jpeg-load.c
	* plug-ins/jpeg/jpeg-save.c
	* plug-ins/jpeg/jpeg.[ch]: renamed global variables used for the
	preview hack.

svn path=/trunk/; revision=23147
This commit is contained in:
Sven Neumann 2007-08-08 10:31:38 +00:00 committed by Sven Neumann
parent f81b2c57b1
commit 40144a272b
5 changed files with 35 additions and 20 deletions

View file

@ -1,3 +1,12 @@
2007-08-08 Sven Neumann <sven@gimp.org>
* plug-ins/jpeg/jpeg-save.c (save_dialog): added missing call to
destroy_preview(). Fixes bug #464457.
* plug-ins/jpeg/jpeg-load.c
* plug-ins/jpeg/jpeg-save.c
* plug-ins/jpeg/jpeg.[ch]: renamed global variables.
2007-08-08 Sven Neumann <sven@gimp.org>
* app/dialogs/preferences-dialog.c: added buttons to unset the

View file

@ -49,9 +49,9 @@ static void jpeg_load_resolution (gint32 image_ID,
static void jpeg_sanitize_comment (gchar *comment);
gint32 volatile image_ID_global;
GimpDrawable *drawable_global;
gint32 layer_ID_global;
gint32 volatile preview_image_ID;
gint32 preview_layer_ID;
gint32
@ -115,7 +115,7 @@ load_image (const gchar *filename,
gimp_image_delete (image_ID);
if (preview)
destroy_preview();
destroy_preview ();
return -1;
}
@ -220,7 +220,7 @@ load_image (const gchar *filename,
if (preview)
{
image_ID = image_ID_global;
image_ID = preview_image_ID;
}
else
{
@ -233,11 +233,11 @@ load_image (const gchar *filename,
if (preview)
{
layer_ID_global = layer_ID =
gimp_layer_new (image_ID, _("JPEG preview"),
cinfo.output_width,
cinfo.output_height,
layer_type, 100, GIMP_NORMAL_MODE);
preview_layer_ID = gimp_layer_new (preview_image_ID, _("JPEG preview"),
cinfo.output_width,
cinfo.output_height,
layer_type, 100, GIMP_NORMAL_MODE);
layer_ID = preview_layer_ID;
}
else
{

View file

@ -711,19 +711,19 @@ make_preview (void)
{
/* we freeze undo saving so that we can avoid sucking up
* tile cache with our unneeded preview steps. */
gimp_image_undo_freeze (image_ID_global);
gimp_image_undo_freeze (preview_image_ID);
undo_touched = TRUE;
}
save_image (tn,
image_ID_global,
preview_image_ID,
drawable_ID_global,
orig_image_ID_global,
TRUE);
if (display_ID == -1)
display_ID = gimp_display_new (image_ID_global);
display_ID = gimp_display_new (preview_image_ID);
}
else
{
@ -745,14 +745,17 @@ destroy_preview (void)
drawable_global = NULL;
}
if (layer_ID_global != -1 && image_ID_global != -1)
g_printerr ("destroy_preview (%d, %d)\n", preview_image_ID, preview_layer_ID);
if (gimp_image_is_valid (preview_image_ID) &&
gimp_drawable_is_valid (preview_layer_ID))
{
/* assuming that reference counting is working correctly,
we do not need to delete the layer, removing it from
the image should be sufficient */
gimp_image_remove_layer (image_ID_global, layer_ID_global);
gimp_image_remove_layer (preview_image_ID, preview_layer_ID);
layer_ID_global = -1;
preview_layer_ID = -1;
}
}
@ -1134,6 +1137,8 @@ save_dialog (void)
gtk_main ();
destroy_preview ();
return pg.run;
}

View file

@ -204,8 +204,9 @@ run (const gchar *name,
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
image_ID_global = -1;
layer_ID_global = -1;
preview_image_ID = -1;
preview_layer_ID = -1;
has_metadata = FALSE;
if (strcmp (name, LOAD_PROC) == 0)
@ -453,7 +454,7 @@ run (const gchar *name,
}
/* prepare for the preview */
image_ID_global = image_ID;
preview_image_ID = image_ID;
orig_image_ID_global = orig_image_ID;
drawable_ID_global = drawable_ID;

View file

@ -41,8 +41,8 @@ typedef struct my_error_mgr
} *my_error_ptr;
extern gint32 volatile image_ID_global;
extern gint32 layer_ID_global;
extern gint32 volatile preview_image_ID;
extern gint32 preview_layer_ID;
extern GimpDrawable *drawable_global;
extern gboolean undo_touched;
extern gboolean load_interactive;