From dad807e7ada1756da25903ca10c8567530ebf934 Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Sat, 9 May 2026 02:00:41 +0200 Subject: [PATCH] gui: add routine to destroy objects outside event loop. --- avr/modules/lcd2/gui/base/guiapp.asm | 32 +++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/avr/modules/lcd2/gui/base/guiapp.asm b/avr/modules/lcd2/gui/base/guiapp.asm index 63d73b3..b54b246 100644 --- a/avr/modules/lcd2/gui/base/guiapp.asm +++ b/avr/modules/lcd2/gui/base/guiapp.asm @@ -356,9 +356,10 @@ GuiApp_OnDestroy: ; @clobbers any, !Y GuiApp_OnTimer: - rcall guiAppCheckTouch ; (any, !Y) - rcall guiAppSendTimerEvents ; (any, !Y) - rcall guiAppCheckSendGuiEvents ; (any, !Y) + rcall guiAppCheckTouch ; (any, !Y) + rcall guiAppSendTimerEvents ; (any, !Y) + rcall guiAppCheckSendGuiEvents ; (any, !Y) + rcall guiAppHandlePendingDestructions ; (any, !Y) sec ret ; @end @@ -619,6 +620,7 @@ guiAppCheckSendGuiEvents: pop yl ldi r16, GUIAPP_GUITIMER std Y+GUIAPP_OFFS_GUITIMER, r16 + guiAppCheckSendGuiEvents_done: pop yh pop yl @@ -627,6 +629,30 @@ guiAppCheckSendGuiEvents_done: +; --------------------------------------------------------------------------- +; @routine guiAppHandlePendingDestructions +; +; Send GUI events to current window if timer elapsed. +; +; @param Y ptr to GUIAPP +; @clobbers any, !Y + +guiAppHandlePendingDestructions: + push yl + push yh + rcall GuiApp_GetRootWindow + brcc guiAppHandlePendingDestructions_done + mov yl, r18 + mov yh, r19 + bigcall OBJ_TreeDestroyMarked +guiAppHandlePendingDestructions_done: + pop yh + pop yl + ret +; @end + + + ; --------------------------------------------------------------------------- ; @routine guiAppSendTouchEvents ;