games/snes9x: Fix crash in "open recent" menu.

This commit is contained in:
B. Watson 2016-09-28 04:26:59 -04:00 committed by Willy Sudiarto Raharjo
parent 40260794b9
commit 5bae02f310
No known key found for this signature in database
GPG key ID: 887B8374D7333381
2 changed files with 40 additions and 1 deletions

View file

@ -0,0 +1,30 @@
From 6d74746342a73cf65db215f4fdecdfb0cae66792 Mon Sep 17 00:00:00 2001
From: Brandon Wright <bearoso@gmail.com>
Date: Mon, 10 Feb 2014 16:28:05 -0600
Subject: [PATCH] Fix bug caused by virtual directories.
---
gtk/src/gtk_file.cpp | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/gtk/src/gtk_file.cpp b/gtk/src/gtk_file.cpp
index a0df75d..9c0e000 100644
--- a/gtk/src/gtk_file.cpp
+++ b/gtk/src/gtk_file.cpp
@@ -465,8 +465,11 @@ S9xOpenROMDialog (void)
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
directory =
gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (dialog));
- strncpy (gui_config->last_directory, directory, PATH_MAX);
- g_free (directory);
+ if (directory)
+ {
+ strncpy (gui_config->last_directory, directory, PATH_MAX);
+ g_free (directory);
+ }
}
else
--
1.9.3

View file

@ -8,7 +8,7 @@
PRGNAM=snes9x PRGNAM=snes9x
VERSION=${VERSION:-1.53} VERSION=${VERSION:-1.53}
BUILD=${BUILD:-1} BUILD=${BUILD:-2}
TAG=${TAG:-_SBo} TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then if [ -z "$ARCH" ]; then
@ -53,6 +53,15 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# Patch avoids crashes caused by the 'open recent' UI menu. Not been
# able to reproduce the crash myself, but all the patch does is check
# a pointer to make sure it's not null, before using it (can't see how
# that could hurt anything).
# Patch came from here:
# https://git.archlinux.org/svntogit/community.git/plain/snes9x/repos/community-i686/snes9x-fix-crash.patch
patch -p1 < $CWD/snes9x-fix-crash.patch
cd gtk cd gtk
CFLAGS="$SLKCFLAGS" \ CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \