plug-ins: babl_init|exit() needs to be run for "file-pdf-load-thumb".

This is run as part of gimp_ui_init() in the normal "file-pdf-load"
calls, but such calls have been forgotten for the thumbnail load
procedure.

Also the GimpRunMode is only a parameter in "file-pdf-load". For
"file-pdf-load-thumb", the first parameter is directly the filename. The
fact it might have used to work is chance as it were only tested against
GIMP_RUN_INTERACTIVE, which is 0, so the test would end up FALSE, which
is what we want for thumbnail loading. Anyway now we get a proper call
(thumbnail loading always considered non-interactive).
This commit is contained in:
Jehan 2019-07-22 12:07:04 +02:00
parent 5d2dbfe2e8
commit e0a24a27de
1 changed files with 7 additions and 4 deletions

View File

@ -376,14 +376,11 @@ run (const gchar *name,
GimpParam **return_vals)
{
static GimpParam values[7];
GimpRunMode run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
gint32 image_ID = -1;
PopplerDocument *doc = NULL;
GError *error = NULL;
run_mode = param[0].data.d_int32;
INIT_I18N ();
*nreturn_vals = 1;
@ -395,7 +392,9 @@ run (const gchar *name,
if (strcmp (name, LOAD_PROC) == 0 || strcmp (name, LOAD2_PROC) == 0)
{
PdfSelectedPages pages = { 0, NULL };
GimpRunMode run_mode;
run_mode = param[0].data.d_int32;
switch (run_mode)
{
case GIMP_RUN_INTERACTIVE:
@ -584,7 +583,8 @@ run (const gchar *name,
doc = open_document (param[0].data.d_string,
loadvals.PDF_password,
run_mode, &error);
GIMP_RUN_NONINTERACTIVE,
&error);
if (doc)
{
@ -612,7 +612,10 @@ run (const gchar *name,
gimp_image_undo_disable (image);
babl_init ();
layer_from_surface (image, "thumbnail", 0, surface, 0.0, 1.0);
babl_exit ();
cairo_surface_destroy (surface);
gimp_image_undo_enable (image);