# HG changeset patch # User Olaf Wintermann # Date 1770907486 -3600 # Node ID e097bc7cfec6ac6767479d7a43706008c279b296 # Parent 512fad602f97de7079d5de0baf643c796c3c0789 add functions for app reference counting diff -r 512fad602f97 -r e097bc7cfec6 ui/cocoa/toolkit.m --- a/ui/cocoa/toolkit.m Sun Feb 08 15:19:40 2026 +0100 +++ b/ui/cocoa/toolkit.m Thu Feb 12 15:44:46 2026 +0100 @@ -120,6 +120,14 @@ } } +void ui_app_ref(void) { + // TODO +} + +void ui_app_unref(void) { + // TODO +} + /* ------------------- Window Visibility functions ------------------- */ void ui_show(UiObject *obj) { diff -r 512fad602f97 -r e097bc7cfec6 ui/common/object.c --- a/ui/common/object.c Sun Feb 08 15:19:40 2026 +0100 +++ b/ui/common/object.c Thu Feb 12 15:44:46 2026 +0100 @@ -63,6 +63,7 @@ UiObject* ui_dummy_object(void) { UiObject *obj = uic_object_new_toplevel(); obj->ref = 1; + ui_app_ref(); return obj; } diff -r 512fad602f97 -r e097bc7cfec6 ui/gtk/toolkit.c --- a/ui/gtk/toolkit.c Sun Feb 08 15:19:40 2026 +0100 +++ b/ui/gtk/toolkit.c Thu Feb 12 15:44:46 2026 +0100 @@ -135,6 +135,24 @@ } } + +void ui_app_ref(void) { +#ifdef UI_APPLICATION + g_application_hold(G_APPLICATION(&app)); +#else + // TODO +#endif +} + +void ui_app_unref(void) { +#ifdef UI_APPLICATION + g_application_release(G_APPLICATION(&app)); +#else + // TODO +#endif +} + + #ifndef UI_GTK2 void ui_app_quit() { g_application_quit(G_APPLICATION(app)); // TODO: fix, does not work @@ -172,6 +190,7 @@ #endif } else { ui_window_close_request(obj); + ui_app_unref(); } } diff -r 512fad602f97 -r e097bc7cfec6 ui/motif/toolkit.c --- a/ui/motif/toolkit.c Sun Feb 08 15:19:40 2026 +0100 +++ b/ui/motif/toolkit.c Thu Feb 12 15:44:46 2026 +0100 @@ -142,6 +142,14 @@ } } +void ui_app_ref(void) { + // TODO +} + +void ui_app_unref(void) { + // TODO +} + void ui_app_quit() { XtAppSetExitFlag(app); } diff -r 512fad602f97 -r e097bc7cfec6 ui/qt/toolkit.cpp --- a/ui/qt/toolkit.cpp Sun Feb 08 15:19:40 2026 +0100 +++ b/ui/qt/toolkit.cpp Thu Feb 12 15:44:46 2026 +0100 @@ -83,6 +83,14 @@ } } +void ui_app_ref(void) { + // TODO +} + +void ui_app_unref(void) { + // TODO +} + void ui_show(UiObject *obj) { obj->widget->show(); } diff -r 512fad602f97 -r e097bc7cfec6 ui/ui/toolkit.h --- a/ui/ui/toolkit.h Sun Feb 08 15:19:40 2026 +0100 +++ b/ui/ui/toolkit.h Thu Feb 12 15:44:46 2026 +0100 @@ -738,6 +738,9 @@ UIEXPORT void ui_object_set(UiObject *obj, const char *key, void *data); UIEXPORT void* ui_object_get(UiObject *obj, const char *key); +UIEXPORT void ui_app_ref(void); +UIEXPORT void ui_app_unref(void); + #ifdef __cplusplus } #endif diff -r 512fad602f97 -r e097bc7cfec6 ui/win32/toolkit.c --- a/ui/win32/toolkit.c Sun Feb 08 15:19:40 2026 +0100 +++ b/ui/win32/toolkit.c Thu Feb 12 15:44:46 2026 +0100 @@ -99,6 +99,14 @@ uic_store_app_properties(); } +void ui_app_ref(void) { + // TODO +} + +void ui_app_unref(void) { + // TODO +} + void ui_show(UiObject *obj) { ui_set_visible(obj->widget, TRUE); }