React on "commit data" OS request.
This commit is contained in:
parent
a8e86b0f26
commit
ab63fa59a6
@ -47,6 +47,7 @@ Application::Application(const QString& id, int& argc, char** argv)
|
||||
#endif
|
||||
|
||||
m_feedReader(nullptr),
|
||||
m_quitLogicDone(false),
|
||||
m_updateFeedsLock(new Mutex()), m_mainForm(nullptr),
|
||||
m_trayIcon(nullptr), m_settings(Settings::setupSettings(this)), m_webFactory(new WebFactory(this)),
|
||||
m_system(new SystemFactory(this)), m_skins(new SkinFactory(this)),
|
||||
@ -424,6 +425,9 @@ void Application::showGuiMessage(const QString& title, const QString& message,
|
||||
|
||||
void Application::onCommitData(QSessionManager& manager) {
|
||||
qDebug("OS asked application to commit its data.");
|
||||
|
||||
onAboutToQuit();
|
||||
|
||||
manager.setRestartHint(QSessionManager::RestartNever);
|
||||
manager.release();
|
||||
}
|
||||
@ -435,6 +439,13 @@ void Application::onSaveState(QSessionManager& manager) {
|
||||
}
|
||||
|
||||
void Application::onAboutToQuit() {
|
||||
if (m_quitLogicDone) {
|
||||
qWarning("On-close logic is already done.");
|
||||
return;
|
||||
}
|
||||
|
||||
m_quitLogicDone = true;
|
||||
|
||||
eliminateFirstRun();
|
||||
eliminateFirstRun(APP_VERSION);
|
||||
|
||||
|
@ -128,8 +128,6 @@ class RSSGUARD_DLLSPEC Application : public QtSingleApplication {
|
||||
void processExecutionMessage(const QString& message);
|
||||
|
||||
private slots:
|
||||
|
||||
// Last-minute reactors.
|
||||
void onCommitData(QSessionManager& manager);
|
||||
void onSaveState(QSessionManager& manager);
|
||||
void onAboutToQuit();
|
||||
@ -152,6 +150,8 @@ class RSSGUARD_DLLSPEC Application : public QtSingleApplication {
|
||||
|
||||
FeedReader* m_feedReader;
|
||||
|
||||
bool m_quitLogicDone;
|
||||
|
||||
// This read-write lock is used by application on its close.
|
||||
// Application locks this lock for WRITING.
|
||||
// This means that if application locks that lock, then
|
||||
|
Loading…
x
Reference in New Issue
Block a user