dwlb

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 992439120383933021e5a4d2db7d26f7931a1e03
parent 1e3e867a04faf410161bad2965883ac96bac62a7
Author: Janne Veteläinen <janne.vetelainen@elisanet.fi>
Date:   Mon,  1 Jul 2024 11:11:42 +0300

Non-async menu update can lock up the entire tray, if the app isn't responding.

Diffstat:
Msystray/sndbusmenu.c | 35+++++++++++++++++++++++------------
1 file changed, 23 insertions(+), 12 deletions(-)

diff --git a/systray/sndbusmenu.c b/systray/sndbusmenu.c @@ -232,24 +232,19 @@ create_menumodel(GVariant *data, SnDbusmenu *self) } static void -layout_update(SnDbusmenu *self) +layout_update_finish(GObject *obj, GAsyncResult *res, void *udata) { + SnDbusmenu *self = SN_DBUSMENU(udata); GError *err = NULL; - - g_debug("%s running menu layout update", self->busname); - self->update_pending = FALSE; - - GVariant *data = g_dbus_proxy_call_sync(self->proxy, - "GetLayout", - g_variant_new("(iias)", 0, -1, NULL), - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, - &err); + + GVariant *data = g_dbus_proxy_call_finish(self->proxy, res, &err); if (err) { g_debug("Error in layout_update %s", err->message); g_error_free(err); + + g_object_unref(self->snitem); + g_object_unref(self); return; } @@ -285,6 +280,22 @@ layout_update(SnDbusmenu *self) } static void +layout_update(SnDbusmenu *self) +{ + g_debug("%s running menu layout update", self->busname); + self->update_pending = FALSE; + + g_dbus_proxy_call(self->proxy, + "GetLayout", + g_variant_new("(iias)", 0, -1, NULL), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + layout_update_finish, + self); +} + +static void reschedule_update(SnItem *snitem, GParamSpec *pspec, void *data) { SnDbusmenu *self = SN_DBUSMENU(data);