Commit 4671f5ea authored by Jean-Francois Dockes's avatar Jean-Francois Dockes
Browse files

Fix bug which was causing the doubling of a non standard (extended) advanced...

Fix bug which was causing the doubling of a non standard (extended) advanced search clauses list every time the prefs were read after the first time during a session
parent d87d410f
......@@ -87,26 +87,40 @@ void rwSettings(bool writing)
SETTING_RW(prefs.ssearchTyp, "/Recoll/prefs/simpleSearchTyp", Int, 3);
"/Recoll/prefs/startWithAdvSearchOpen", Bool, false);
"/Recoll/prefs/previewHtml", Bool, true);
SETTING_RW(prefs.previewHtml, "/Recoll/prefs/previewHtml", Bool, true);
QString advSearchClauses;
QString ascdflt;
const int maxclauselistsize = 20;
if (writing) {
for (vector<int>::iterator it = prefs.advSearchClauses.begin();
it != prefs.advSearchClauses.end(); it++) {
// Limit clause list size to non-absurd size
if (prefs.advSearchClauses.size() > maxclauselistsize) {
for (auto clause : prefs.advSearchClauses) {
char buf[20];
sprintf(buf, "%d ", *it);
sprintf(buf, "%d ", clause);
advSearchClauses += QString::fromUtf8(buf);
QString ascdflt;
SETTING_RW(advSearchClauses, "/Recoll/prefs/adv/clauseList", String, ascdflt);
if (!writing) {
list<string> clauses;
stringToStrings((const char *)advSearchClauses.toUtf8(), clauses);
for (list<string>::iterator it = clauses.begin();
it != clauses.end(); it++) {
vector<string> clauses;
stringToStrings(qs2utf8s(advSearchClauses), clauses);
// There was a long-lurking bug where the clause list was
// growing to absurd sizes. The prefs.advSearchClauses clear()
// call was missing (ok with the now false initial assumption
// that the prefs were read once per session), which was
// causing a doubling of the size each time the prefs were
// read. Should be fixed, but in any case, limit the clause
// list to a non-absurd size.
if (clauses.size() > maxclauselistsize) {
for (auto clause : clauses) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment