Detach GUI SQLite readers before worker teardown

This commit is contained in:
evgeny committed 2026-10-28 00:59:00 +01:00
1 parent ce133a6acf
commit adefef675c
3 files changed
+53 -1

No files matched your search

+10 -1
View File
@@ -331,6 +331,11 @@ void MainWindow::setupNode() {
connect(m_node, &UtunNode::started, this, [this]() {
qDebug("UtunNode started");
});
connect(m_node, &UtunNode::stopping, this, [this] {
m_autoPlayTimer->stop(); m_autoPlayQueue.clear(); m_autoPlayDownloading.clear();
if (m_db) m_db->setDb(nullptr);
DEBUG_INFO(DEBUG_CATEGORY_SYS, "desktop GUI database detached before core teardown");
});
connect(m_node, &UtunNode::stopped, this, [this]() {
qDebug("UtunNode stopped");
qApp->quit();
@@ -514,7 +519,11 @@ void MainWindow::setupBridgeCallbacks() {
gui_bridge_set_channel_peers_online_cb(onChannelPeersOnlineCallback);
gui_bridge_set_db_ready_cb([]() {
if (!s_mainWindow || !s_mainWindow->m_db) return;
s_mainWindow->m_db->setDb(chat_core_get_db(gui_bridge_get_inst()));
auto* node = s_mainWindow->m_node;
auto* database = node ? node->databaseHandle() : nullptr;
if (!database) { DEBUG_WARN(DEBUG_CATEGORY_SYS, "desktop DB_READY ignored while core unavailable/stopping"); return; }
s_mainWindow->m_db->setDb(database);
s_mainWindow->m_db->setMyNodeId(node->nodeIdHex().toULongLong(nullptr, 16));
if (AvatarManager::instance()) AvatarManager::instance()->initialize();
RadioAudioEngine::instance()->loadSettings(s_mainWindow->m_cfgPath);
s_mainWindow->m_channelList->loadChannels();