summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Bernardini <ponce@slackbuilds.org>2019-12-25 22:12:03 +0100
committerRobby Workman <rworkman@slackbuilds.org>2021-04-18 00:01:02 -0500
commit584ee28512a4f96f6619784bf6477562b3ed0ccf (patch)
treede294661020688304bf36dc98790c76fd1eeb454
parent1c87424c8a5b6f663a4b1fe4d7a6436fc5e961f5 (diff)
downloadslackbuilds-584ee28512a4f96f6619784bf6477562b3ed0ccf.tar.gz
libraries/t4k_common: Fix segfaults with the newer librsvg.
Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
-rw-r--r--libraries/t4k_common/916060_bugfix.patch32
-rw-r--r--libraries/t4k_common/t4k_common.SlackBuild3
2 files changed, 35 insertions, 0 deletions
diff --git a/libraries/t4k_common/916060_bugfix.patch b/libraries/t4k_common/916060_bugfix.patch
new file mode 100644
index 0000000000..e8c8a499f7
--- /dev/null
+++ b/libraries/t4k_common/916060_bugfix.patch
@@ -0,0 +1,32 @@
+Description: fix loading each frame from SVG sprites
+ rsvg_handle_get_desc returns null so next sscanf segfaults. Use instead iterating
+ up from zero for id frame%d
+Author: cdonoghu@gmail.com
+Origin: other
+Forwarded: no
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/src/t4k_loaders.c
++++ b/src/t4k_loaders.c
+@@ -213,14 +213,13 @@
+ new_sprite = malloc(sizeof(sprite));
+ new_sprite->default_img = render_svg_from_handle(file_handle, width, height, "#default");
+
+- /* get number of frames from description */
+- sscanf(rsvg_handle_get_desc(file_handle), "%d", &new_sprite->num_frames);
+- DEBUGMSG(debug_loaders, "load_svg_sprite(): loading %d frames\n", new_sprite->num_frames);
+-
+- for(i = 0; i < new_sprite->num_frames; i++)
+- {
+- sprintf(lay_name, "#frame%d", i);
+- new_sprite->frame[i] = render_svg_from_handle(file_handle, width, height, lay_name);
++ /* get number of frames directly. End when #frame<num> doesn't exist */
++ new_sprite->num_frames = 0;
++ while(1) {
++ sprintf(lay_name, "#frame%d", new_sprite->num_frames);
++ if ( ! (rsvg_handle_has_sub(file_handle, lay_name)) ) break;
++ new_sprite->frame[new_sprite->num_frames] = render_svg_from_handle(file_handle, width, height, lay_name);
++ new_sprite->num_frames++;
+ }
+
+ g_object_unref(file_handle);
diff --git a/libraries/t4k_common/t4k_common.SlackBuild b/libraries/t4k_common/t4k_common.SlackBuild
index 9fb0cad487..71f7238a31 100644
--- a/libraries/t4k_common/t4k_common.SlackBuild
+++ b/libraries/t4k_common/t4k_common.SlackBuild
@@ -54,6 +54,9 @@ find -L . \
# Patch for libpng16 (-current) (from Debian)
patch -p1 < $CWD/libpng.patch
+# Fix segfaults with then newer librsvg (from Debian)
+patch -p1 < $CWD/916060_bugfix.patch
+
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \