From 009b99cb029a3173a49d225c105948310238d230 Mon Sep 17 00:00:00 2001 From: Ralph Little Date: Tue, 24 Aug 2021 20:20:33 -0700 Subject: [PATCH] xscanimage: don't set curves that are hidden and uncreated. --- src/gtkglue.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gtkglue.c b/src/gtkglue.c index 3a39f3c..b3f6938 100644 --- a/src/gtkglue.c +++ b/src/gtkglue.c @@ -403,10 +403,10 @@ button_update (GtkWidget * widget, GSGDialogElement * elem) { GSGDialog *dialog = elem->dialog; int opt_num = elem - dialog->element; - const SANE_Option_Descriptor *opt; +// const SANE_Option_Descriptor *opt; SANE_Word val = SANE_FALSE; - opt = sane_get_option_descriptor (dialog->dev, opt_num); +// opt = sane_get_option_descriptor (dialog->dev, opt_num); if (GTK_TOGGLE_BUTTON (widget)->active) val = SANE_TRUE; set_option (dialog, opt_num, &val, SANE_ACTION_SET_VALUE); @@ -1420,12 +1420,16 @@ gsg_sync (GSGDialog * dialog) if (!SANE_OPTION_IS_ACTIVE (opt->cap)) continue; - if (opt->type != SANE_TYPE_INT && opt->type != SANE_TYPE_FIXED) + if ((opt->type != SANE_TYPE_INT) && (opt->type != SANE_TYPE_FIXED)) continue; if (opt->size == sizeof (SANE_Word)) continue; + // If curves is hidden (advanced option perhaps) then nothing to do. + if (!dialog->element[i].widget) + continue; + /* ok, we're dealing with an active vector */ optlen = opt->size / sizeof (SANE_Word);