don't crash if no files are selected (#608047)

This commit is contained in:
Nils Philippsen 2010-06-28 09:10:17 +00:00
parent 2bc7320289
commit 5021989a29
2 changed files with 52 additions and 1 deletions

View File

@ -0,0 +1,43 @@
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-06-28 10:49:29.302391248 +0200
@@ -1501,12 +1501,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-06-28 10:46:31.025142803 +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))
+ {
+ xsane_set_sensitivity(TRUE);
+ return;
+ }
umask(XSANE_DEFAULT_UMASK); /* define new file permissions */
if (preferences.filename)

View File

@ -6,7 +6,7 @@
Name: xsane Name: xsane
Summary: X Window System front-end for the SANE scanner interface Summary: X Window System front-end for the SANE scanner interface
Version: 0.997 Version: 0.997
Release: 5%{?dist} Release: 6%{?dist}
Source0: http://www.xsane.org/download/%{name}-%{version}.tar.gz Source0: http://www.xsane.org/download/%{name}-%{version}.tar.gz
Source1: xsane.desktop Source1: xsane.desktop
# distro-specific: use "xdg-open" instead of "netscape" to launch help browser # distro-specific: use "xdg-open" instead of "netscape" to launch help browser
@ -19,6 +19,9 @@ Patch2: xsane-0.996-no-eula.patch
# enable off-root building # enable off-root building
# submitted to upstream (Oliver Rauch) via email, 2010-06-23 # submitted to upstream (Oliver Rauch) via email, 2010-06-23
Patch3: xsane-0.997-off-root-build.patch Patch3: xsane-0.997-off-root-build.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=608047
# submitted to upstream (Oliver Rauch) via email, 2010-06-28
Patch4: xsane-0.997-no-file-selected.patch
# autoconf-generated files # autoconf-generated files
Patch10: xsane-0.997-5-autoconf.patch.bz2 Patch10: xsane-0.997-5-autoconf.patch.bz2
License: GPLv2+ License: GPLv2+
@ -73,6 +76,8 @@ done
%patch1 -p1 -b .close-fds %patch1 -p1 -b .close-fds
%patch2 -p1 -b .no-eula %patch2 -p1 -b .no-eula
%patch3 -p1 -b .off-root-build %patch3 -p1 -b .off-root-build
%patch4 -p1 -b .no-file-selected
%patch10 -p1 -b .autoconf %patch10 -p1 -b .autoconf
# in-root config.h breaks off-root building # in-root config.h breaks off-root building
@ -144,6 +149,9 @@ fi
%{_datadir}/sane/xsane %{_datadir}/sane/xsane
%changelog %changelog
* Mon Jun 28 2010 Nils Philippsen <nils@redhat.com> 0.997-6
- don't crash if no files are selected (#608047)
* Wed Jun 23 2010 Nils Philippsen <nils@redhat.com> 0.997-5 * Wed Jun 23 2010 Nils Philippsen <nils@redhat.com> 0.997-5
- don't use gimp-plugin-mgr anymore - don't use gimp-plugin-mgr anymore
- use off-root builds - use off-root builds