|
From: | Daniel J Sebald |
Subject: | QSettings deleted by singleton-cleanup mechanism |
Date: | Wed, 17 Jun 2015 14:43:53 -0500 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16 |
According to the Qt documentation: http://doc.qt.io/qt-4.8/qsettings.html#syncthe QSettings are periodically saved and saved when the object is deleted. It seems to me rather straightforward for the main window to create a QSettings object when it is created. The QSettings will be automatically deleted when the main window is deleted and consequently save the settings to permanent storage then. Or, another approach would be to create a QSettings locally, save any changes in the QSettings and delete the QSettings locally.
The problem with having some other thread save the settings is if that thread is interrupted abruptly (say with a force close, which I'm trying to fix at the moment), it can remove the QSettings or incompletely save settings.
Dan
[Prev in Thread] | Current Thread | [Next in Thread] |