diff --git a/src/startmanager.cpp b/src/startmanager.cpp index 90d84634..d663de78 100644 --- a/src/startmanager.cpp +++ b/src/startmanager.cpp @@ -805,8 +805,8 @@ void StartManager::slotCloseWindow() // 导致被附加到上一文本编辑器进程 QDBusConnection::sessionBus().unregisterService("com.deepin.Editor"); - QTimer::singleShot(1000, []() { - StartManager::instance()->delayMallocTrim(); + QTimer::singleShot(1000, [this]() { + this->delayMallocTrim(); QApplication::quit(); }); diff --git a/src/widgets/window.cpp b/src/widgets/window.cpp index 6ff212b3..ffd8c408 100644 --- a/src/widgets/window.cpp +++ b/src/widgets/window.cpp @@ -1199,8 +1199,10 @@ void Window::removeWrapper(const QString &filePath, bool isDelete) } } - // Exit window after close all tabs. - if (m_wrappers.isEmpty()) { + // Exit window after close all tabs (including pending and blank tabs). + // Pending tabs are kept in m_pendingTabs, blank tabs are managed by the tabbar. + // Only close the window when the tabbar has no tabs left. + if (m_wrappers.isEmpty() && m_tabbar->count() == 0) { close(); qInfo() << "after close"; }