Slightly modified version of the former 003 Fedora patch, in order to fix gentoo bug 396127 diff -up xsane-0.997/src/xsane-back-gtk.c.no-file-selected xsane-0.997/src/xsane-back-gtk.c --- xsane-0.997/src/xsane-back-gtk.c.no-file-selected 2002-10-02 13:05:52.000000000 +0200 +++ xsane-0.997/src/xsane-back-gtk.c 2010-07-13 10:02:09.468118791 +0200 @@ -1111,6 +1111,11 @@ static void xsane_back_gtk_filetype2_cal chooser_filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(filechooser)); + if (!chooser_filename) + { + return; + } + if ((new_filetype) && (*new_filetype)) { extension = strrchr(chooser_filename, '.'); @@ -1501,12 +1506,19 @@ int xsane_back_gtk_get_filename(const ch #endif chooser_filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(filechooser)); - strncpy(filename, chooser_filename, max_len - 1); - g_free(chooser_filename); + if (chooser_filename) + { + strncpy(filename, chooser_filename, max_len - 1); + g_free(chooser_filename); - filename[max_len - 1] = '\0'; + filename[max_len - 1] = '\0'; - ok = TRUE; + ok = TRUE; + } + else + { + ok = FALSE; + } } gtk_widget_destroy(filechooser); diff -up xsane-0.997/src/xsane-front-gtk.c.no-file-selected xsane-0.997/src/xsane-front-gtk.c --- xsane-0.997/src/xsane-front-gtk.c.no-file-selected 2002-10-02 13:04:33.000000000 +0200 +++ xsane-0.997/src/xsane-front-gtk.c 2010-07-13 09:59:31.005868940 +0200 @@ -1339,7 +1339,11 @@ static void xsane_browse_filename_callba snprintf(windowname, sizeof(windowname), "%s %s %s", xsane.prog_name, WINDOW_OUTPUT_FILENAME, xsane.device_text); umask((mode_t) preferences.directory_umask); /* define new file permissions */ - xsane_back_gtk_get_filename(windowname, filename, sizeof(filename), filename, &preferences.filetype, &preferences.cms_function, XSANE_FILE_CHOOSER_ACTION_SELECT_SAVE, show_extra_widgets, XSANE_FILE_FILTER_ALL | XSANE_FILE_FILTER_IMAGES, XSANE_FILE_FILTER_IMAGES); + if (xsane_back_gtk_get_filename(windowname, filename, sizeof(filename), filename, &preferences.filetype, &preferences.cms_function, XSANE_FILE_CHOOSER_ACTION_SELECT_SAVE, show_extra_widgets, XSANE_FILE_FILTER_ALL | XSANE_FILE_FILTER_IMAGES, XSANE_FILE_FILTER_IMAGES) < 0) + { + xsane_set_sensitivity(TRUE); + return; + } umask(XSANE_DEFAULT_UMASK); /* define new file permissions */ if (preferences.filename)