chatgui: synchronous DB write in saveChannelState/updateReadPosition, add shutdown debug logs
Replace gui_bridge_post_uasync_fn (async queue lost on shutdown) with direct chat_core_save_ui_state (sync SQLite write). SQLite WAL handles concurrent access. Add DEBUG_DEBUG traces in closeEvent, ~MainWindow, aboutToQuit.
This commit is contained in:
1 parent
393b7d36c8
commit
fdc30d1a4e
2 files changed
+9
-16
No files matched your search
@@ -85,7 +85,9 @@ MainWindow::MainWindow(QWidget *parent, DbManager* db, const QString& cfgPath,
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() {
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "MainWindow: ~MainWindow — stopping utun node");
|
||||
if (m_node) { m_node->stop(); delete m_node; m_node = nullptr; }
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "MainWindow: ~MainWindow done");
|
||||
}
|
||||
|
||||
void MainWindow::setupUi() {
|
||||
@@ -230,7 +232,10 @@ void MainWindow::setupConnects() {
|
||||
m_db->getUnreadCount(channelId, lastReadMsgId));
|
||||
});
|
||||
|
||||
connect(qApp, &QApplication::aboutToQuit, m_messageList, &MessageList::saveChannelState);
|
||||
connect(qApp, &QApplication::aboutToQuit, this, [this]() {
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "MainWindow: aboutToQuit — saving channel state");
|
||||
if (m_messageList) m_messageList->saveChannelState();
|
||||
});
|
||||
}
|
||||
|
||||
void MainWindow::setupTray() {
|
||||
@@ -263,6 +268,7 @@ void MainWindow::setupTray() {
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent *event) {
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "MainWindow: closeEvent — hiding to tray");
|
||||
hide();
|
||||
m_trayIcon->showMessage("Chat", "Application minimized to tray.",
|
||||
QSystemTrayIcon::Information, 2000);
|
||||
|
||||
Reference in new issue
Block a user