Fence deferred message actions, release voice views and flush state before shutdown

This commit is contained in:
evgeny committed 2026-10-28 00:59:00 +01:00
1 parent 9f4d98fd19
commit a17c4ae435
3 files changed
+45 -20

No files matched your search

+12 -1
View File
@@ -1257,7 +1257,18 @@ void MainWindow::requestShutdown() {
DEBUG_DEBUG(DEBUG_CATEGORY_GENERAL, "MainWindow: requestShutdown — saving geometry and stopping node");
if (m_messageNotification) m_messageNotification->dismiss("shutdown");
saveWindowGeometry();
if (m_node) m_node->requestStop();
if (m_messageList) m_messageList->saveChannelState();
// FIFO: stop исполняется после уже принятых записей UI. Node живёт до join его worker.
auto** request = static_cast<UtunNode**>(u_malloc(sizeof(UtunNode*)));
if (!request) {
DEBUG_ERROR(DEBUG_CATEGORY_SYS, "desktop shutdown queue allocation failed; stopping directly"); m_node->requestStop(); return;
}
*request = m_node;
if (gui_bridge_post_uasync_owned_fn([](void* arg) {
auto* node = *static_cast<UtunNode**>(arg); u_free(arg); node->requestStop();
}, request) < 0) {
u_free(request); DEBUG_WARN(DEBUG_CATEGORY_SYS, "desktop shutdown queue unavailable; stopping directly"); m_node->requestStop();
} else DEBUG_INFO(DEBUG_CATEGORY_SYS, "desktop shutdown queued after UI state writes");
}
void MainWindow::onShutdownCheck() {