GUI: avoid writing qt/recoll settings if we did not read them first. Some configuration error cases (unexisting recoll config dir) could result into settings being erased
This commit is contained in:
parent
fdfb77bf5b
commit
4e2266495f
@ -51,6 +51,11 @@ RclConfig *theconfig;
|
|||||||
RclConfig *thestableconfig;
|
RclConfig *thestableconfig;
|
||||||
PTMutexInit thestableconfiglock;
|
PTMutexInit thestableconfiglock;
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
void snapshotConfig()
|
void snapshotConfig()
|
||||||
{
|
{
|
||||||
PTMutexLocker locker(thestableconfiglock);
|
PTMutexLocker locker(thestableconfiglock);
|
||||||
@ -140,8 +145,10 @@ bool getStemLangs(list<string>& langs)
|
|||||||
|
|
||||||
static void recollCleanup()
|
static void recollCleanup()
|
||||||
{
|
{
|
||||||
LOGDEB(("recollCleanup: writing settings\n"));
|
if (havereadsettings) {
|
||||||
rwSettings(true);
|
LOGDEB(("recollCleanup: writing settings\n"));
|
||||||
|
rwSettings(true);
|
||||||
|
}
|
||||||
LOGDEB2(("recollCleanup: closing database\n"));
|
LOGDEB2(("recollCleanup: closing database\n"));
|
||||||
deleteZ(rcldb);
|
deleteZ(rcldb);
|
||||||
deleteZ(theconfig);
|
deleteZ(theconfig);
|
||||||
@ -305,6 +312,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
// fprintf(stderr, "History done\n");
|
// fprintf(stderr, "History done\n");
|
||||||
rwSettings(false);
|
rwSettings(false);
|
||||||
|
havereadsettings = true;
|
||||||
// fprintf(stderr, "Settings done\n");
|
// fprintf(stderr, "Settings done\n");
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user