don't crash if no files are selected (#608047)
This commit is contained in:
parent
2bc7320289
commit
5021989a29
43
xsane-0.997-no-file-selected.patch
Normal file
43
xsane-0.997-no-file-selected.patch
Normal 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)
|
10
xsane.spec
10
xsane.spec
@ -6,7 +6,7 @@
|
||||
Name: xsane
|
||||
Summary: X Window System front-end for the SANE scanner interface
|
||||
Version: 0.997
|
||||
Release: 5%{?dist}
|
||||
Release: 6%{?dist}
|
||||
Source0: http://www.xsane.org/download/%{name}-%{version}.tar.gz
|
||||
Source1: xsane.desktop
|
||||
# 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
|
||||
# submitted to upstream (Oliver Rauch) via email, 2010-06-23
|
||||
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
|
||||
Patch10: xsane-0.997-5-autoconf.patch.bz2
|
||||
License: GPLv2+
|
||||
@ -73,6 +76,8 @@ done
|
||||
%patch1 -p1 -b .close-fds
|
||||
%patch2 -p1 -b .no-eula
|
||||
%patch3 -p1 -b .off-root-build
|
||||
%patch4 -p1 -b .no-file-selected
|
||||
|
||||
%patch10 -p1 -b .autoconf
|
||||
|
||||
# in-root config.h breaks off-root building
|
||||
@ -144,6 +149,9 @@ fi
|
||||
%{_datadir}/sane/xsane
|
||||
|
||||
%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
|
||||
- don't use gimp-plugin-mgr anymore
|
||||
- use off-root builds
|
||||
|
Loading…
Reference in New Issue
Block a user