diff -r bedd499b640d -r b8277deb75b8 ui/gtk/menu.c --- a/ui/gtk/menu.c Wed Nov 27 13:28:21 2024 +0100 +++ b/ui/gtk/menu.c Wed Nov 27 18:46:45 2024 +0100 @@ -35,6 +35,7 @@ #include "toolkit.h" #include "../common/context.h" #include "../common/menu.h" +#include "../common/types.h" #include "../ui/properties.h" #include "../ui/window.h" #include "container.h" @@ -252,10 +253,9 @@ ls->callback = il->callback; ls->userdata = il->userdata; - ls->list->observers = ui_add_observer( - ls->list->observers, - (ui_callback)ui_update_menuitem_list, - ls); + UiObserver *observer = ui_observer_new((ui_callback)ui_update_menuitem_list, ls); + list->observers = ui_obsvlist_add(list->observers, observer); + uic_list_register_observer_destructor(obj->ctx, list, observer); ui_update_menuitem_list(NULL, ls); } @@ -510,10 +510,9 @@ ls->callback = il->callback; ls->userdata = il->userdata; - list->observers = ui_add_observer( - list->observers, - (ui_callback)ui_update_gmenu_item_list, - ls); + UiObserver *observer = ui_observer_new((ui_callback)ui_update_gmenu_item_list, ls); + list->observers = ui_obsvlist_add(list->observers, observer); + uic_list_register_observer_destructor(obj->ctx, list, observer); GSimpleAction *action = g_simple_action_new(item->id, g_variant_type_new("i")); g_action_map_add_action(obj->ctx->action_map, G_ACTION(action));