From 9a34bb8f90fe7ccfa6c6e758adfcecdb82a36fe0 Mon Sep 17 00:00:00 2001 From: Jozef Mlich Date: Fri, 19 Jan 2024 18:40:42 +0200 Subject: [PATCH] ngfd: avoid crashes https://github.com/nemomobile-ux/main/issues/51 --- ...1-ffmemless-Dont-destroy-empty-table.patch | 38 +++++++++++++++++++ ngfd/PKGBUILD | 13 +++++-- 2 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 ngfd/0001-ffmemless-Dont-destroy-empty-table.patch diff --git a/ngfd/0001-ffmemless-Dont-destroy-empty-table.patch b/ngfd/0001-ffmemless-Dont-destroy-empty-table.patch new file mode 100644 index 00000000..5ef97171 --- /dev/null +++ b/ngfd/0001-ffmemless-Dont-destroy-empty-table.patch @@ -0,0 +1,38 @@ +From ed793b0359ec1c7c2a53bf7f0d11c97cadf82d47 Mon Sep 17 00:00:00 2001 +From: Sergey Chupligin +Date: Thu, 23 Mar 2023 11:46:00 +0300 +Subject: [PATCH] ffmemless: Dont destroy empty table + +--- + src/plugins/ffmemless/plugin.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/plugins/ffmemless/plugin.c b/src/plugins/ffmemless/plugin.c +index bc9b70a..f143272 100644 +--- a/src/plugins/ffmemless/plugin.c ++++ b/src/plugins/ffmemless/plugin.c +@@ -539,7 +539,9 @@ static int ffm_setup_effects(const NProplist *props, GHashTable *effects) + + return 0; + ffm_eff_error1: +- g_hash_table_destroy(ffm.effects); ++ if(g_hash_table_size(ffm.effects) > 0) { ++ g_hash_table_destroy(ffm.effects); ++ } + return -1; + } + +@@ -605,7 +607,9 @@ static int ffm_play(struct ffm_effect_data *data, int play) + static void ffm_sink_shutdown(NSinkInterface *iface) + { + (void) iface; +- g_hash_table_destroy(ffm.effects); ++ if(g_hash_table_size(ffm.effects) > 0) { ++ g_hash_table_destroy(ffm.effects); ++ } + ffm_close_device(ffm.dev_file); + } + +-- +2.43.0 + diff --git a/ngfd/PKGBUILD b/ngfd/PKGBUILD index 57efad49..5692219b 100644 --- a/ngfd/PKGBUILD +++ b/ngfd/PKGBUILD @@ -3,7 +3,7 @@ pkgname=ngfd pkgver=1.4.1 -pkgrel=1 +pkgrel=2 pkgdesc="Non-Graphic Feedback daemon" arch=('x86_64' 'aarch64') url="https://github.com/sailfishos/ngfd" @@ -17,8 +17,12 @@ depends=('ohm-plugins-misc' 'mce-headers') makedepends=('git' 'doxygen') -source=("${url}/archive/refs/tags/$pkgver.tar.gz") -sha256sums=('d1c28d0597a4297e92d1589b51af339a96b0668bd61309dc1786c9949c8841b0') +source=("${url}/archive/refs/tags/$pkgver.tar.gz" + '0001-ffmemless-Dont-destroy-empty-table.patch' +) +sha256sums=('d1c28d0597a4297e92d1589b51af339a96b0668bd61309dc1786c9949c8841b0' + '39aeee24f3ca5f8379459c0ba0644cea65262da9d76bb4fe2fa7b1713894a363' +) prepare() { cd $pkgname-$pkgver @@ -26,6 +30,9 @@ prepare() { git clone https://github.com/sailfishos-mirror/dbus-glib.git dbus-gmain cd dbus-gmain git reset --hard d42176ae4763e5288ef37ea314fe58387faf2005 + cd .. + + patch -p1 --input="${srcdir}/0001-ffmemless-Dont-destroy-empty-table.patch" }