diff --git a/plug-ins/common/animation-optimize.c b/plug-ins/common/animation-optimize.c index 9043cfd7bf..1399d0b296 100644 --- a/plug-ins/common/animation-optimize.c +++ b/plug-ins/common/animation-optimize.c @@ -90,9 +90,10 @@ static GimpValueArray * optimize_run (GimpProcedure *procedu GimpProcedureConfig *config, gpointer run_data); -static GimpImage * do_optimizations (GimpRunMode run_mode, - GimpImage *image, - gboolean diff_only); +static GimpImage * do_optimizations (GimpRunMode run_mode, + GimpImage *image, + gboolean diff_only, + GError **error); /* tag util functions*/ static gint parse_ms_tag (const gchar *str); @@ -313,6 +314,7 @@ optimize_run (GimpProcedure *procedure, GimpValueArray *return_vals; const gchar *name = gimp_procedure_get_name (procedure); gboolean diff_only = FALSE; + GError *error = NULL; gegl_init (NULL, NULL); @@ -338,11 +340,16 @@ optimize_run (GimpProcedure *procedure, opmode = OPFOREGROUND; } - image = do_optimizations (run_mode, image, diff_only); + image = do_optimizations (run_mode, image, diff_only, &error); if (run_mode != GIMP_RUN_NONINTERACTIVE) gimp_displays_flush (); + if (image == NULL) + return gimp_procedure_new_return_values (procedure, + GIMP_PDB_EXECUTION_ERROR, + error); + return_vals = gimp_procedure_new_return_values (procedure, GIMP_PDB_SUCCESS, NULL); @@ -481,9 +488,10 @@ compose_row (gint frame_num, static GimpImage * -do_optimizations (GimpRunMode run_mode, - GimpImage *image, - gboolean diff_only) +do_optimizations (GimpRunMode run_mode, + GimpImage *image, + gboolean diff_only, + GError **error) { GimpImage *new_image; GimpImageBaseType imagetype; @@ -760,7 +768,17 @@ do_optimizations (GimpRunMode run_mode, /* FIXME - How do we tell if a gimp_drawable_get () fails? */ if (gimp_drawable_get_width (drawable) == 0) { - gimp_quit (); + gimp_image_delete (new_image); + g_free (rawframe); + g_free (last_frame); + g_free (this_frame); + g_free (opti_frame); + g_free (back_frame); + + g_set_error (error, GIMP_PLUG_IN_ERROR, 0, + "Drawable has size 0"); + + return NULL; } this_delay = get_frame_duration (this_frame_num); diff --git a/plug-ins/common/animation-play.c b/plug-ins/common/animation-play.c index 94a37f556a..bcae2c2573 100644 --- a/plug-ins/common/animation-play.c +++ b/plug-ins/common/animation-play.c @@ -1059,7 +1059,6 @@ init_frames (GimpPlay *play) { gimp_message (_("Memory could not be allocated to the frame container.")); gtk_widget_destroy (GTK_WIDGET (window)); - gimp_quit (); return; } diff --git a/plug-ins/common/file-sunras.c b/plug-ins/common/file-sunras.c index e522379b4f..da048c70f7 100644 --- a/plug-ins/common/file-sunras.c +++ b/plug-ins/common/file-sunras.c @@ -460,8 +460,10 @@ load_image (GFile *file, if (sunhdr.l_ras_maplength > (256 * 3)) { - g_message ("Map lengths greater than 256 entries are unsupported by GIMP."); - gimp_quit (); + g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, + "Map lengths greater than 256 entries are unsupported by GIMP."); + fclose (ifp); + return NULL; } /* Is there a RGB colormap ? */ diff --git a/plug-ins/common/jigsaw.c b/plug-ins/common/jigsaw.c index 230fad7ad6..46b0612a75 100644 --- a/plug-ins/common/jigsaw.c +++ b/plug-ins/common/jigsaw.c @@ -788,8 +788,8 @@ draw_jigsaw (GObject *config, } else { - g_printerr (_("draw_jigsaw: bad style\n")); - gimp_quit (); + /* This should never happen. */ + g_critical (_("draw_jigsaw: bad style\n")); } if (! preview_mode) diff --git a/plug-ins/file-faxg3/faxg3.c b/plug-ins/file-faxg3/faxg3.c index d6ed69aeeb..60fc2200de 100644 --- a/plug-ins/file-faxg3/faxg3.c +++ b/plug-ins/file-faxg3/faxg3.c @@ -280,9 +280,11 @@ load_image (GFile *file, rs = read (fd, rbuf, sizeof (rbuf)); if (rs < 0) { - perror ("read"); close (fd); - gimp_quit (); + g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno), + _("Error while reading '%s': %s"), + gimp_file_get_utf8_name (file), g_strerror (errno)); + return NULL; } rr += rs;