xscanimage patch #2(er, 3): preview window segfault

Matto Marjanovic (maddog@mir.com)
Thu, 30 Apr 1998 11:24:35 -0400 (EDT)

Here's another patch, to fix the problem with xscanimage segfaulting
when the Preview window is closed. (It also clears up a warning if
you compile without GIMP support.)

Basic problem: preview_window_destroyed() expected an extra argument
containing a GdkEvent, which isn't supplied. Again, I think the design
of GTK+ changed in some subtle way ("non-event signals no longer send a
GdkEvent argument"). This patch fixes that, and cleans up the declarations
of a couple of other signal handlers (which didn't suffer because of
fortunate use of arguments).

-matt m.

--- frontend/xscanimage.c-dist Sun Apr 26 11:46:31 1998
+++ frontend/xscanimage.c Thu Apr 30 10:54:52 1998
@@ -465,14 +467,14 @@
/* Invoked when window manager's "delete" (or "close") function is
invoked. */
static gint
-scan_win_delete (GtkWidget *w, GdkEvent *e, gpointer data)
+scan_win_delete (GtkWidget *w, gpointer data)
{
quit_xscan();
return FALSE;
}

static void
-preview_window_destroyed (GtkWidget *widget, GdkEvent *e, gpointer call_data)
+preview_window_destroyed (GtkWidget *widget, gpointer call_data)
{
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (call_data), FALSE);
}
@@ -734,12 +779,14 @@
}
return;

+#ifdef HAVE_LIBGIMP_GIMP_H
bad_depth:
snprintf (buf, sizeof (buf), "Cannot handle depth %d.",
scan_win.param.depth);
gsg_error (buf);
scan_done ();
return;
+#endif /* HAVE_LIBGIMP_GIMP_H */
}

static void
@@ -962,8 +1014,7 @@

/* Invoked when the scan button is pressed */
static void
-scan_dialog (GtkWidget * widget,
- gpointer client_data, gpointer call_data)
+scan_dialog (GtkWidget * widget, gpointer call_data)
{
char buf[256];

--- frontend/gtkglue.c-dist Wed Apr 29 16:05:00 1998
+++ frontend/gtkglue.c Thu Apr 30 11:09:25 1998
@@ -207,7 +207,7 @@

void
gsg_close_dialog_callback (GtkWidget * widget,
- gpointer client_data, gpointer call_data)
+ gpointer client_data)
{
gtk_widget_destroy (client_data);
gsg_message_dialog_active = 0;

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com