diff --git a/tools/chatgui/src/mainwindow.cpp b/tools/chatgui/src/mainwindow.cpp index aaf53890..22898dc1 100644 --- a/tools/chatgui/src/mainwindow.cpp +++ b/tools/chatgui/src/mainwindow.cpp @@ -525,6 +525,7 @@ void MainWindow::setupBridgeCallbacks() { 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->setDbPath(node->databasePath()); s_mainWindow->m_db->setMyNodeId(node->nodeIdHex().toULongLong(nullptr, 16)); if (AvatarManager::instance()) AvatarManager::instance()->initialize(); RadioAudioEngine::instance()->loadSettings(s_mainWindow->m_cfgPath); diff --git a/tools/chatgui/transport/utun_node.cpp b/tools/chatgui/transport/utun_node.cpp index 3f2be471..1d897b0a 100644 --- a/tools/chatgui/transport/utun_node.cpp +++ b/tools/chatgui/transport/utun_node.cpp @@ -126,6 +126,11 @@ struct sqlite3* UtunNode::databaseHandle() const { return m_stopping ? nullptr : m_snapshot.database; } +QString UtunNode::databasePath() const { + std::lock_guard guard(m_snapshotMutex); + return m_snapshot.databasePath; +} + void UtunNode::finalize() { gui_bridge_set_inst(nullptr); gui_bridge_set_uasync(nullptr); @@ -169,6 +174,7 @@ void UtunNode::updateSnapshot(const UTUN_INSTANCE* inst) { std::lock_guard guard(m_snapshotMutex); if (!inst) { m_snapshot = {}; return; } m_snapshot.database = inst->topo_sqlite_db; + m_snapshot.databasePath = QString::fromUtf8(inst->config->global.db_path); if (m_snapshot.nodeId.isEmpty()) { char id[17]; snprintf(id, sizeof(id), "%016" PRIx64, inst->node_id); m_snapshot.nodeId = QString::fromLatin1(id); diff --git a/tools/chatgui/transport/utun_node.h b/tools/chatgui/transport/utun_node.h index 2fe5ff95..f3b20f59 100644 --- a/tools/chatgui/transport/utun_node.h +++ b/tools/chatgui/transport/utun_node.h @@ -48,6 +48,7 @@ public: /* GUI: заимствованный handle, живой до stopping; после сигнала новые чтения запрещены. * Слот stopping снимает handle без вызова stop/join. Worker ждёт завершения слотов перед destroy. */ struct sqlite3* databaseHandle() const; + QString databasePath() const; // Копия фактического каталога db_path ядра; пусто без instance. // Копии данных ядра, безопасны вне uasync; до старта/после stop — пустые строки, 0/false. QString nodeIdHex() const; @@ -73,6 +74,7 @@ private: int64_t ntpOffsetUs = 0; bool ntpSynced = false, ntpEnabled = false; struct sqlite3* database = nullptr; // Заимствован до подтверждения stopping в GUI. + QString databasePath; // Каталог SQLite/media после применения GUI override. } m_snapshot; // Копия для GUI; доступ под m_snapshotMutex, указателей ядра не содержит. mutable std::mutex m_snapshotMutex; std::atomic m_instance{nullptr}; // Публикуется после готовности; не продлевает жизнь ядра.