From 5bae02f310b28e7a2516a8d476a526bbef197438 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 28 Sep 2016 04:26:59 -0400 Subject: [PATCH] games/snes9x: Fix crash in "open recent" menu. --- games/snes9x/snes9x-fix-crash.patch | 30 +++++++++++++++++++++++++++++ games/snes9x/snes9x.SlackBuild | 11 ++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 games/snes9x/snes9x-fix-crash.patch diff --git a/games/snes9x/snes9x-fix-crash.patch b/games/snes9x/snes9x-fix-crash.patch new file mode 100644 index 0000000000..95ed192e0d --- /dev/null +++ b/games/snes9x/snes9x-fix-crash.patch @@ -0,0 +1,30 @@ +From 6d74746342a73cf65db215f4fdecdfb0cae66792 Mon Sep 17 00:00:00 2001 +From: Brandon Wright +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 + diff --git a/games/snes9x/snes9x.SlackBuild b/games/snes9x/snes9x.SlackBuild index 48fafca1a3..1f54a10180 100644 --- a/games/snes9x/snes9x.SlackBuild +++ b/games/snes9x/snes9x.SlackBuild @@ -8,7 +8,7 @@ PRGNAM=snes9x VERSION=${VERSION:-1.53} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} if [ -z "$ARCH" ]; then @@ -53,6 +53,15 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -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 CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \