chatgui: add SIGINT/SIGTERM handler (as in utun.c), save scroll pos on every debounce
Signal handler via g_shutdown + uasync_wakeup ensures clean uasync poll exit. updateReadPosition() now saves both lastReadMsgId and lastPosMsgId on every scroll stop (300ms debounce), not just when read position changes. connect(stopped, quit) triggers graceful Qt shutdown after uasync cleanup.
This commit is contained in:
1 parent
83ca0c65a4
commit
6cafff200b
3 files changed
+36
-11
No files matched your search
@@ -84,6 +84,8 @@ MainWindow::MainWindow(QWidget *parent, DbManager* db, const QString& cfgPath,
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() {
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "MainWindow: ~MainWindow — saving channel state");
|
||||
if (m_messageList) m_messageList->saveChannelState();
|
||||
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");
|
||||
@@ -120,6 +122,7 @@ void MainWindow::setupNode() {
|
||||
connect(m_node, &UtunNode::stopped, this, []() {
|
||||
qDebug("UtunNode stopped");
|
||||
});
|
||||
connect(m_node, &UtunNode::stopped, qApp, &QApplication::quit);
|
||||
|
||||
if (!m_cfgDebugFile.isEmpty())
|
||||
m_node->setDebugFile(m_cfgDebugFile);
|
||||
@@ -230,11 +233,6 @@ void MainWindow::setupConnects() {
|
||||
m_channelList->setChannelUnreadCount(channelId,
|
||||
m_db->getUnreadCount(channelId, lastReadMsgId));
|
||||
});
|
||||
|
||||
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() {
|
||||
|
||||
Reference in new issue
Block a user