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

4
mdx.cc
View file

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