--- a/ui/common/object.c Fri Nov 15 21:16:18 2024 +0100 +++ b/ui/common/object.c Fri Nov 15 21:23:16 2024 +0100 @@ -54,7 +54,9 @@ } void ui_object_unref(UiObject *obj) { - if(--obj->ref == 0) { + // it is possible to have 0 references, in case + // a window was created but ui_show was never called + if(obj->ref == 0 || --obj->ref == 0) { if(obj->destroy) { obj->destroy(obj); } else {