Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
fix(settings): save settings early on Windows shutdown
Browse files Browse the repository at this point in the history
Need to save before top level window is closed.

Fix #1969
  • Loading branch information
anthonybilinski committed Sep 14, 2018
1 parent ffbcbdd commit 7839a26
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ QMutex* logBufferMutex = new QMutex();

void cleanup()
{
// force save early even though destruction saves, because Windows OS will
// close qTox before cleanup() is finished if logging out or shutting down,
// once the top level window has exited, which occurs in ~Widget within
// ~Nexus. Re-ordering Nexus destruction is not trivial.
auto& s = Settings::getInstance();
s.saveGlobal();
s.savePersonal();
s.sync();

Nexus::destroyInstance();
CameraSource::destroyInstance();
Settings::destroyInstance();
Expand Down

0 comments on commit 7839a26

Please sign in to comment.