Skip to content

Commit

Permalink
ngfd: avoid crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
jmlich committed Jan 19, 2024
1 parent da21070 commit 9a34bb8
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 3 deletions.
38 changes: 38 additions & 0 deletions ngfd/0001-ffmemless-Dont-destroy-empty-table.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From ed793b0359ec1c7c2a53bf7f0d11c97cadf82d47 Mon Sep 17 00:00:00 2001
From: Sergey Chupligin <[email protected]>
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

13 changes: 10 additions & 3 deletions ngfd/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -17,15 +17,22 @@ 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
rm -rf dbus-gmain
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"
}


Expand Down

0 comments on commit 9a34bb8

Please sign in to comment.