tint2: add patch to prevent segfaults with latest glib

This commit is contained in:
John McQuah 2023-07-24 12:58:25 -04:00
parent b46353251a
commit f2d9e4cd39
3 changed files with 51 additions and 4 deletions

View File

@ -1,5 +1,6 @@
untrusted comment: verify with /etc/ports/contrib.pub
RWSagIOpLGJF33MwDkDVE41P44Hy+VpK2kMIl+F4xkZCCgBiTAxc1JWwKAtHISENOwOGOfXckoaKkOInPpL4i0sslVMlRcMFtQs=
SHA256 (Pkgfile) = 24a59dc9520e91093349a25de68924de5bb2bf814677ecf19d78f57578e90075
RWSagIOpLGJF38HkN0uJM0b3NhJJOJ2QEGQ94X7IpUDVwWLz9IAs8YR9lQuA1cfGk/Q5lL8/zhAl2pVh3/mfoNCPe5dMqd0iDQ0=
SHA256 (Pkgfile) = 374b03035a4cecf9d053799797ef69022f626746eeb7127171137e63c6d4cc6b
SHA256 (.footprint) = b746628a98545b6c2444ccae628c80abc67c9ec030f83ac4837870fc89d3aa54
SHA256 (tint2-17.1.3.tar.bz2) = d49103d60a8753fa5e808e57f4cc028f677009a3594eb0f64dcfdc6d2b96e33c
SHA256 (tint2-glib.patch) = 7e1b68ae24efd0c394270d55dd0237c2777b526e10b37198991b483b634b8424

View File

@ -5,10 +5,12 @@
name=tint2
version=17.1.3
release=1
source=(https://gitlab.com/nick87720z/$name/-/archive/$version/$name-$version.tar.bz2)
release=2
source=(https://gitlab.com/nick87720z/$name/-/archive/$version/$name-$version.tar.bz2 $name-glib.patch)
build() {
patch -p1 -d $name-$version -i $SRC/$name-glib.patch
cmake -S $name-$version -B build -G Ninja \
-D CMAKE_INSTALL_PREFIX=/usr \
-D CMAKE_BUILD_TYPE=Release \

44
tint2/tint2-glib.patch Normal file
View File

@ -0,0 +1,44 @@
diff --git a/src/main.c b/src/main.c
index a0b90ae..d9c6742 100644
--- a/src/main.c
+++ b/src/main.c
@@ -534,11 +534,14 @@ void handle_x_event(XEvent *e)
}
if (e->xany.window == g_tooltip.window || !systray_enabled)
break;
- for (GSList *it = systray.list_icons; it; it = it->next)
+ /* we might remove elements in the callback so a copy is needed */
+ GSList *list = g_list_copy(systray.list_icons);
+ for (GSList *it = list; it; it = it->next)
{
- if (((TrayWindow *)it->data)->win == e->xany.window)
+ if (it->data != NULL && ((TrayWindow *)it->data)->win == e->xany.window)
systray_destroy_event(it->data);
}
+ g_list_free(list);
break;
case ClientMessage: {
diff --git a/src/util/uevent.c b/src/util/uevent.c
index b0acefa..5c48b52 100644
--- a/src/util/uevent.c
+++ b/src/util/uevent.c
@@ -146,7 +146,9 @@ void uevent_handler( fd_set *fds, int *fdn)
struct uevent ev;
if (uevent_new(&ev, buf, len)) {
- for (GSList *l = notifiers; l; l = l->next)
+ /* we might remove elements in the callback so a copy is needed */
+ GSList *list = g_list_copy(notifiers);
+ for (GSList *l = list; l; l = l->next)
{
struct uevent_notify *nb = l->data;
@@ -157,6 +159,7 @@ void uevent_handler( fd_set *fds, int *fdn)
nb->cb(&ev, nb->userdata);
}
+ g_list_free(list);
uevent_destroy (&ev);
}
}