Used to write settings in the exit handler, do it earlier because it crashes qt5
This commit is contained in:
parent
1b786815b7
commit
f2ce709a15
3 changed files with 11 additions and 10 deletions
|
@ -64,9 +64,16 @@ PrefsPack prefs;
|
|||
* structure during program execution and saved to disk using the QT
|
||||
* settings mechanism
|
||||
*/
|
||||
/* Remember if settings were actually read (to avoid writing them if
|
||||
* we stopped before reading them (else some kinds of errors would reset
|
||||
* the qt/recoll settings to defaults) */
|
||||
static bool havereadsettings;
|
||||
|
||||
void rwSettings(bool writing)
|
||||
{
|
||||
LOGDEB1(("rwSettings: write %d\n", int(writing)));
|
||||
if (writing && !havereadsettings)
|
||||
return;
|
||||
QSettings settings("Recoll.org", "recoll");
|
||||
SETTING_RW(prefs.mainwidth, "/Recoll/geometry/width", Int, 0);
|
||||
SETTING_RW(prefs.mainheight, "/Recoll/geometry/height", Int, 0);
|
||||
|
@ -383,6 +390,8 @@ void rwSettings(bool writing)
|
|||
for (list<string>::iterator it = tl.begin(); it != tl.end(); it++)
|
||||
prefs.asearchSubdirHist.push_front(QString::fromUtf8(it->c_str()));
|
||||
}
|
||||
if (!writing)
|
||||
havereadsettings = true;
|
||||
}
|
||||
|
||||
string PrefsPack::stemlang()
|
||||
|
|
|
@ -52,11 +52,6 @@
|
|||
|
||||
extern RclConfig *theconfig;
|
||||
|
||||
// To avoid writing settings if we stopped before reading them (else
|
||||
// some kinds of errors would reset the qt/recoll settings to
|
||||
// defaults)
|
||||
static bool havereadsettings;
|
||||
|
||||
PTMutexInit thetempfileslock;
|
||||
static vector<TempFile> o_tempfiles;
|
||||
/* Keep an array of temporary files for deletion at exit. It happens that we
|
||||
|
@ -155,10 +150,6 @@ bool getStemLangs(vector<string>& vlangs)
|
|||
|
||||
static void recollCleanup()
|
||||
{
|
||||
if (havereadsettings) {
|
||||
LOGDEB(("recollCleanup: writing settings\n"));
|
||||
rwSettings(true);
|
||||
}
|
||||
LOGDEB2(("recollCleanup: closing database\n"));
|
||||
deleteZ(rcldb);
|
||||
deleteZ(theconfig);
|
||||
|
@ -349,7 +340,6 @@ int main(int argc, char **argv)
|
|||
|
||||
// fprintf(stderr, "History done\n");
|
||||
rwSettings(false);
|
||||
havereadsettings = true;
|
||||
// fprintf(stderr, "Settings done\n");
|
||||
|
||||
if (!prefs.qssFile.isEmpty()) {
|
||||
|
|
|
@ -700,6 +700,8 @@ void RclMain::fileExit()
|
|||
if (asearchform)
|
||||
delete asearchform;
|
||||
|
||||
rwSettings(true);
|
||||
|
||||
// Let the exit handler clean up the rest (internal recoll stuff).
|
||||
exit(0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue