mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 04:24:09 +00:00
fix: fix double release pointer
This commit is contained in:
parent
4d452e7a63
commit
aa94af4382
|
@ -21,7 +21,7 @@ EditDictionaries::EditDictionaries( QWidget * parent,
|
||||||
origCfg( cfg ),
|
origCfg( cfg ),
|
||||||
sources( this, cfg ),
|
sources( this, cfg ),
|
||||||
orderAndProps( new OrderAndProps( this, cfg.dictionaryOrder, cfg.inactiveDictionaries, dictionaries ) ),
|
orderAndProps( new OrderAndProps( this, cfg.dictionaryOrder, cfg.inactiveDictionaries, dictionaries ) ),
|
||||||
groups( std::make_shared< Groups >( this, dictionaries, cfg.groups, orderAndProps->getCurrentDictionaryOrder() ) ),
|
groups( new Groups( this, dictionaries, cfg.groups, orderAndProps->getCurrentDictionaryOrder() ) ),
|
||||||
dictionariesChanged( false ),
|
dictionariesChanged( false ),
|
||||||
groupsChanged( false ),
|
groupsChanged( false ),
|
||||||
helpAction( this )
|
helpAction( this )
|
||||||
|
@ -208,8 +208,8 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups )
|
||||||
// free them.
|
// free them.
|
||||||
ui.tabs->setUpdatesEnabled( false );
|
ui.tabs->setUpdatesEnabled( false );
|
||||||
|
|
||||||
groups.reset();
|
groups.clear();
|
||||||
orderAndProps.reset();
|
orderAndProps.clear();
|
||||||
|
|
||||||
loadDictionaries( this, true, cfg, dictionaries, dictNetMgr );
|
loadDictionaries( this, true, cfg, dictionaries, dictNetMgr );
|
||||||
|
|
||||||
|
@ -238,10 +238,8 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups )
|
||||||
if ( rebuildGroups ) {
|
if ( rebuildGroups ) {
|
||||||
ui.tabs->removeTab( 1 );
|
ui.tabs->removeTab( 1 );
|
||||||
ui.tabs->removeTab( 1 );
|
ui.tabs->removeTab( 1 );
|
||||||
orderAndProps.reset( new OrderAndProps( this, savedOrder, savedInactive, dictionaries ) );
|
orderAndProps = new OrderAndProps( this, savedOrder, savedInactive, dictionaries );
|
||||||
std::shared_ptr< Groups > other =
|
groups = new Groups( this, dictionaries, savedGroups, orderAndProps->getCurrentDictionaryOrder() );
|
||||||
std::make_shared< Groups >( this, dictionaries, savedGroups, orderAndProps->getCurrentDictionaryOrder() );
|
|
||||||
groups.swap( other );
|
|
||||||
|
|
||||||
ui.tabs->insertTab( 1, orderAndProps.get(), QIcon( ":/icons/book.svg" ), tr( "&Dictionaries" ) );
|
ui.tabs->insertTab( 1, orderAndProps.get(), QIcon( ":/icons/book.svg" ), tr( "&Dictionaries" ) );
|
||||||
|
|
||||||
|
|
|
@ -78,8 +78,8 @@ private:
|
||||||
|
|
||||||
Ui::EditDictionaries ui;
|
Ui::EditDictionaries ui;
|
||||||
Sources sources;
|
Sources sources;
|
||||||
QScopedPointer< OrderAndProps > orderAndProps;
|
QPointer< OrderAndProps > orderAndProps;
|
||||||
sptr< Groups > groups;
|
QPointer< Groups > groups;
|
||||||
|
|
||||||
bool dictionariesChanged;
|
bool dictionariesChanged;
|
||||||
bool groupsChanged;
|
bool groupsChanged;
|
||||||
|
|
Loading…
Reference in a new issue