fix:large memory consumption when edit dictionaries through right menu context

This commit is contained in:
yifang 2022-03-03 23:59:42 +08:00
parent f16b25737d
commit 4a96067e86
2 changed files with 14 additions and 14 deletions

View file

@ -867,7 +867,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
prepareNewReleaseChecks();
// makeDictionaries() didn't do deferred init - we do it here, at the end.
doDeferredInit( dictionaries );
//doDeferredInit( dictionaries );
updateStatusLine();
@ -2050,9 +2050,6 @@ void MainWindow::editDictionaries( unsigned editDictionaryGroup )
closeHeadwordsDialog();
closeFullTextSearchDialog();
ftsIndexing.stopIndexing();
ftsIndexing.clearDictionaries();
wordFinder.clear();
dictionariesUnmuted.clear();
@ -2078,7 +2075,8 @@ void MainWindow::editDictionaries( unsigned editDictionaryGroup )
if ( dicts.areDictionariesChanged() || dicts.areGroupsChanged() )
{
ftsIndexing.stopIndexing();
ftsIndexing.clearDictionaries();
// Set muted dictionaries from old groups
for( int x = 0; x < newCfg.groups.size(); x++ )
{
@ -2101,6 +2099,15 @@ void MainWindow::editDictionaries( unsigned editDictionaryGroup )
Config::save( cfg );
updateSuggestionList();
for( unsigned x = 0; x < dictionaries.size(); x++ )
{
dictionaries[ x ]->setFTSParameters( cfg.preferences.fts );
dictionaries[ x ]->setSynonymSearchEnabled( cfg.preferences.synonymSearchEnabled );
}
ftsIndexing.setDictionaries( dictionaries );
ftsIndexing.doIndexing();
}
}
@ -2108,14 +2115,7 @@ void MainWindow::editDictionaries( unsigned editDictionaryGroup )
makeScanPopup();
installHotKeys();
for( unsigned x = 0; x < dictionaries.size(); x++ )
{
dictionaries[ x ]->setFTSParameters( cfg.preferences.fts );
dictionaries[ x ]->setSynonymSearchEnabled( cfg.preferences.synonymSearchEnabled );
}
ftsIndexing.setDictionaries( dictionaries );
ftsIndexing.doIndexing();
}
void MainWindow::editCurrentGroup()

4
mdx.cc
View file

@ -268,8 +268,8 @@ public:
virtual void setFTSParameters( Config::FullTextSearch const & fts )
{
if( ensureInitDone().size() )
return;
// if( ensureInitDone().size() )
// return;
can_FTS = fts.enabled
&& !fts.disabledTypes.contains( "MDICT", Qt::CaseInsensitive )