mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 00:14:06 +00:00
+! Clear group instances before reloading dictionaries. Hopefully this would
fix problems under Windows, where only one file mapping can exist.
This commit is contained in:
parent
74b04ff788
commit
2a81429d0a
|
@ -9,8 +9,10 @@ using std::vector;
|
|||
|
||||
EditDictionaries::EditDictionaries( QWidget * parent, Config::Class & cfg_,
|
||||
vector< sptr< Dictionary::Class > > & dictionaries_,
|
||||
Instances::Groups & groupInstances_,
|
||||
QNetworkAccessManager & dictNetMgr_ ):
|
||||
QDialog( parent ), cfg( cfg_ ), dictionaries( dictionaries_ ),
|
||||
groupInstances( groupInstances_ ),
|
||||
dictNetMgr( dictNetMgr_ ),
|
||||
origCfg( cfg ),
|
||||
sources( this, cfg.paths, cfg.soundDirs, cfg.hunspell, cfg.transliteration,
|
||||
|
@ -121,6 +123,9 @@ void EditDictionaries::acceptChangedSources()
|
|||
cfg.transliteration = sources.getTransliteration();
|
||||
cfg.mediawikis = sources.getMediaWikis();
|
||||
|
||||
groupInstances.clear(); // Those hold pointers to dictionaries, we need to
|
||||
// free them.
|
||||
|
||||
loadDictionaries( this, true, cfg, dictionaries, dictNetMgr );
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "ui_editdictionaries.h"
|
||||
#include "sources.hh"
|
||||
#include "groups.hh"
|
||||
#include "instances.hh"
|
||||
#include <QNetworkAccessManager>
|
||||
|
||||
class EditDictionaries: public QDialog
|
||||
|
@ -19,6 +20,7 @@ public:
|
|||
|
||||
EditDictionaries( QWidget * parent, Config::Class & cfg,
|
||||
std::vector< sptr< Dictionary::Class > > & dictionaries,
|
||||
Instances::Groups & groupInstances, // We only clear those on rescan
|
||||
QNetworkAccessManager & dictNetMgr );
|
||||
|
||||
/// Returns true if any changes to the 'dictionaries' vector passed were done.
|
||||
|
@ -51,6 +53,7 @@ private:
|
|||
|
||||
Config::Class & cfg;
|
||||
std::vector< sptr< Dictionary::Class > > & dictionaries;
|
||||
Instances::Groups & groupInstances;
|
||||
QNetworkAccessManager & dictNetMgr;
|
||||
|
||||
// Backed up to decide later if something was changed or not
|
||||
|
|
|
@ -627,7 +627,7 @@ void MainWindow::editDictionaries()
|
|||
hotkeyWrapper.reset(); // No hotkeys while we're editing dictionaries
|
||||
scanPopup.reset(); // No scan popup either. No one should use dictionaries.
|
||||
|
||||
EditDictionaries dicts( this, cfg, dictionaries, dictNetMgr );
|
||||
EditDictionaries dicts( this, cfg, dictionaries, groupInstances, dictNetMgr );
|
||||
|
||||
dicts.exec();
|
||||
|
||||
|
@ -1389,6 +1389,8 @@ void MainWindow::on_rescanFiles_activated()
|
|||
hotkeyWrapper.reset(); // No hotkeys while we're editing dictionaries
|
||||
scanPopup.reset(); // No scan popup either. No one should use dictionaries.
|
||||
|
||||
groupInstances.clear(); // Release all the dictionaries they hold
|
||||
|
||||
loadDictionaries( this, true, cfg, dictionaries, dictNetMgr );
|
||||
|
||||
updateGroupList();
|
||||
|
|
Loading…
Reference in a new issue