diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-03-11 16:39:24 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-03-11 16:50:03 +0100 |
commit | 465359c35fcd8c30a2bedd3d0beb07c0c1c36cba (patch) | |
tree | 3959801825b12a5def0a4e6402917a455aa9c6a2 | |
parent | a7b9167235d38130aab1af4bed66b6c48d375fc9 (diff) |
do not call virtual Commit() from dtors of utl::ConfigItem subclasses
~SvtAppFilterOptions_Impl() demonstrates that this is a bad idea, by not
invoking its subclasses' ImplCommit() but its own.
Change-Id: Ic675e9cd3be1494c740a4f289be3bdbf0d1a122b
22 files changed, 22 insertions, 84 deletions
diff --git a/extensions/source/bibliography/bibconfig.cxx b/extensions/source/bibliography/bibconfig.cxx index 4c7b65c9a559..5a3ed541a608 100644 --- a/extensions/source/bibliography/bibconfig.cxx +++ b/extensions/source/bibliography/bibconfig.cxx @@ -192,8 +192,7 @@ BibConfig::BibConfig() BibConfig::~BibConfig() { - if(IsModified()) - Commit(); + assert(!IsModified()); // should have been committed delete pMappingsArr; } diff --git a/framework/source/fwe/classes/addonsoptions.cxx b/framework/source/fwe/classes/addonsoptions.cxx index 58699066b38a..dae10bd5a45b 100644 --- a/framework/source/fwe/classes/addonsoptions.cxx +++ b/framework/source/fwe/classes/addonsoptions.cxx @@ -378,11 +378,7 @@ AddonsOptions_Impl::AddonsOptions_Impl() AddonsOptions_Impl::~AddonsOptions_Impl() { - // We must save our current values .. if user forget it! - if( IsModified() ) - { - Commit(); - } + assert(!IsModified()); // should have been committed } void AddonsOptions_Impl::ReadConfigurationData() diff --git a/svl/source/config/ctloptions.cxx b/svl/source/config/ctloptions.cxx index 3cca42821a50..b2e79acc54fe 100644 --- a/svl/source/config/ctloptions.cxx +++ b/svl/source/config/ctloptions.cxx @@ -128,8 +128,7 @@ SvtCTLOptions_Impl::SvtCTLOptions_Impl() : } SvtCTLOptions_Impl::~SvtCTLOptions_Impl() { - if ( IsModified() ) - Commit(); + assert(!IsModified()); // should have been committed } void SvtCTLOptions_Impl::Notify( const Sequence< OUString >& ) diff --git a/svtools/source/config/menuoptions.cxx b/svtools/source/config/menuoptions.cxx index 60d931a6f31e..1a7421595ef4 100644 --- a/svtools/source/config/menuoptions.cxx +++ b/svtools/source/config/menuoptions.cxx @@ -227,12 +227,7 @@ SvtMenuOptions_Impl::SvtMenuOptions_Impl() SvtMenuOptions_Impl::~SvtMenuOptions_Impl() { - // Flush data to configuration! - // User has no chance to do that. - if( IsModified() ) - { - Commit(); - } + assert(!IsModified()); // should have been committed } diff --git a/svtools/source/config/miscopt.cxx b/svtools/source/config/miscopt.cxx index 9d4fcaf2870f..0dd13809f899 100644 --- a/svtools/source/config/miscopt.cxx +++ b/svtools/source/config/miscopt.cxx @@ -386,11 +386,7 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl() SvtMiscOptions_Impl::~SvtMiscOptions_Impl() { - // We must save our current values .. if user forgets it! - if( IsModified() ) - { - Commit(); - } + assert(!IsModified()); // should have been committed } static int lcl_MapPropertyName( const OUString& rCompare, diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx index 1e398d9e276d..d706f5e5b8cd 100644 --- a/svtools/source/config/optionsdrawinglayer.cxx +++ b/svtools/source/config/optionsdrawinglayer.cxx @@ -543,8 +543,7 @@ SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl() : SvtOptionsDrawinglayer_Impl::~SvtOptionsDrawinglayer_Impl() { - if( IsModified() ) - Commit(); + assert(!IsModified()); // should have been committed } diff --git a/svtools/source/config/slidesorterbaropt.cxx b/svtools/source/config/slidesorterbaropt.cxx index cf0e0c6d3c6d..dd62de329771 100644 --- a/svtools/source/config/slidesorterbaropt.cxx +++ b/svtools/source/config/slidesorterbaropt.cxx @@ -172,7 +172,7 @@ SvtSlideSorterBarOptions_Impl::SvtSlideSorterBarOptions_Impl() SvtSlideSorterBarOptions_Impl::~SvtSlideSorterBarOptions_Impl() { - Commit(); + assert(!IsModified()); // should have been committed } static int lcl_MapPropertyName( const OUString& rCompare, diff --git a/svtools/source/config/toolpanelopt.cxx b/svtools/source/config/toolpanelopt.cxx index 4934eeb6b545..4ae9153eca11 100644 --- a/svtools/source/config/toolpanelopt.cxx +++ b/svtools/source/config/toolpanelopt.cxx @@ -170,7 +170,7 @@ SvtToolPanelOptions_Impl::SvtToolPanelOptions_Impl() SvtToolPanelOptions_Impl::~SvtToolPanelOptions_Impl() { - Commit(); + assert(!IsModified()); // should have been committed } static int lcl_MapPropertyName( const OUString& rCompare, diff --git a/unotools/source/config/cmdoptions.cxx b/unotools/source/config/cmdoptions.cxx index b6d96899fce6..b55d8a84f31c 100644 --- a/unotools/source/config/cmdoptions.cxx +++ b/unotools/source/config/cmdoptions.cxx @@ -175,11 +175,7 @@ SvtCommandOptions_Impl::SvtCommandOptions_Impl() SvtCommandOptions_Impl::~SvtCommandOptions_Impl() { - // We must save our current values .. if user forget it! - if( IsModified() ) - { - Commit(); - } + assert(!IsModified()); // should have been committed } // public method diff --git a/unotools/source/config/compatibility.cxx b/unotools/source/config/compatibility.cxx index f91981d1a262..71ed62143971 100644 --- a/unotools/source/config/compatibility.cxx +++ b/unotools/source/config/compatibility.cxx @@ -365,11 +365,7 @@ SvtCompatibilityOptions_Impl::SvtCompatibilityOptions_Impl() SvtCompatibilityOptions_Impl::~SvtCompatibilityOptions_Impl() { - // We must save our current values .. if user forget it! - if( IsModified() ) - { - Commit(); - } + assert(!IsModified()); // should have been committed } void SvtCompatibilityOptions_Impl::SetDefault( const OUString & sName, bool bValue ) diff --git a/unotools/source/config/dynamicmenuoptions.cxx b/unotools/source/config/dynamicmenuoptions.cxx index f406c8d225f2..1fac5954c420 100644 --- a/unotools/source/config/dynamicmenuoptions.cxx +++ b/unotools/source/config/dynamicmenuoptions.cxx @@ -353,11 +353,7 @@ SvtDynamicMenuOptions_Impl::SvtDynamicMenuOptions_Impl() SvtDynamicMenuOptions_Impl::~SvtDynamicMenuOptions_Impl() { - // We must save our current values .. if user forget it! - if( IsModified() ) - { - Commit(); - } + assert(!IsModified()); // should have been committed } // public method diff --git a/unotools/source/config/eventcfg.cxx b/unotools/source/config/eventcfg.cxx index bd3f79ca46e7..cb46c6dc3a09 100644 --- a/unotools/source/config/eventcfg.cxx +++ b/unotools/source/config/eventcfg.cxx @@ -122,11 +122,7 @@ GlobalEventConfig_Impl::GlobalEventConfig_Impl() GlobalEventConfig_Impl::~GlobalEventConfig_Impl() { - // We must save our current values .. if user forget it! - if( IsModified() ) - { - Commit(); - } + assert(!IsModified()); // should have been committed } OUString GlobalEventConfig_Impl::GetEventName( sal_Int32 nIndex ) diff --git a/unotools/source/config/extendedsecurityoptions.cxx b/unotools/source/config/extendedsecurityoptions.cxx index d7db4b8db683..1443c7307a88 100644 --- a/unotools/source/config/extendedsecurityoptions.cxx +++ b/unotools/source/config/extendedsecurityoptions.cxx @@ -152,11 +152,7 @@ SvtExtendedSecurityOptions_Impl::SvtExtendedSecurityOptions_Impl() SvtExtendedSecurityOptions_Impl::~SvtExtendedSecurityOptions_Impl() { - // We must save our current values .. if user forget it! - if( IsModified() ) - { - Commit(); - } + assert(!IsModified()); // should have been committed } // public method diff --git a/unotools/source/config/fltrcfg.cxx b/unotools/source/config/fltrcfg.cxx index d929b312cc7e..3139ce52d3d8 100644 --- a/unotools/source/config/fltrcfg.cxx +++ b/unotools/source/config/fltrcfg.cxx @@ -88,8 +88,7 @@ public: SvtAppFilterOptions_Impl::~SvtAppFilterOptions_Impl() { - if(IsModified()) - Commit(); + assert(!IsModified()); // should have been committed } void SvtAppFilterOptions_Impl::ImplCommit() diff --git a/unotools/source/config/fontoptions.cxx b/unotools/source/config/fontoptions.cxx index 5766b9a9603c..fa2b52aceecd 100644 --- a/unotools/source/config/fontoptions.cxx +++ b/unotools/source/config/fontoptions.cxx @@ -150,11 +150,7 @@ SvtFontOptions_Impl::SvtFontOptions_Impl() SvtFontOptions_Impl::~SvtFontOptions_Impl() { - // We must save our current values .. if user forget it! - if( IsModified() ) - { - Commit(); - } + assert(!IsModified()); // should have been committed } // public method diff --git a/unotools/source/config/localisationoptions.cxx b/unotools/source/config/localisationoptions.cxx index f2f2ab1a315c..9707104f63f8 100644 --- a/unotools/source/config/localisationoptions.cxx +++ b/unotools/source/config/localisationoptions.cxx @@ -139,11 +139,7 @@ SvtLocalisationOptions_Impl::SvtLocalisationOptions_Impl() SvtLocalisationOptions_Impl::~SvtLocalisationOptions_Impl() { - // We must save our current values .. if user forget it! - if( IsModified() ) - { - Commit(); - } + assert(!IsModified()); // should have been committed } // public method diff --git a/unotools/source/config/moduleoptions.cxx b/unotools/source/config/moduleoptions.cxx index 7f1b55fe4863..f5ad76ce0ba5 100644 --- a/unotools/source/config/moduleoptions.cxx +++ b/unotools/source/config/moduleoptions.cxx @@ -355,22 +355,9 @@ SvtModuleOptions_Impl::SvtModuleOptions_Impl() EnableNotification( lFactories ); } -/*-************************************************************************************************************ - @short default dtor - @descr If any values of our cache was modified we should write it back to configuration. - - @attention Don't forget to call "SetModified()" method of base class ConfigItem if any interface method - of this class modify internal member list m_lFactories! Otherwise Commit() will never be called!!! - - @seealso baseclass ConfigItem - @threadsafe no -*//*-*************************************************************************************************************/ SvtModuleOptions_Impl::~SvtModuleOptions_Impl() { - if( IsModified() ) - { - Commit(); - } + assert(!IsModified()); // should have been committed } /*-************************************************************************************************************ diff --git a/unotools/source/config/printwarningoptions.cxx b/unotools/source/config/printwarningoptions.cxx index 33d61f2c4252..166e845f1711 100644 --- a/unotools/source/config/printwarningoptions.cxx +++ b/unotools/source/config/printwarningoptions.cxx @@ -159,8 +159,7 @@ SvtPrintWarningOptions_Impl::SvtPrintWarningOptions_Impl() : SvtPrintWarningOptions_Impl::~SvtPrintWarningOptions_Impl() { - if( IsModified() ) - Commit(); + assert(!IsModified()); // should have been committed } // Commit diff --git a/unotools/source/config/searchopt.cxx b/unotools/source/config/searchopt.cxx index 59eae30135bf..76154d8723ee 100644 --- a/unotools/source/config/searchopt.cxx +++ b/unotools/source/config/searchopt.cxx @@ -75,7 +75,7 @@ SvtSearchOptions_Impl::SvtSearchOptions_Impl() : SvtSearchOptions_Impl::~SvtSearchOptions_Impl() { - Commit(); + assert(!IsModified()); // should have been committed } void SvtSearchOptions_Impl::ImplCommit() diff --git a/unotools/source/config/securityoptions.cxx b/unotools/source/config/securityoptions.cxx index c235a73bc168..3c00b0eb46ce 100644 --- a/unotools/source/config/securityoptions.cxx +++ b/unotools/source/config/securityoptions.cxx @@ -274,8 +274,7 @@ SvtSecurityOptions_Impl::SvtSecurityOptions_Impl() SvtSecurityOptions_Impl::~SvtSecurityOptions_Impl() { - if( IsModified() ) - Commit(); + assert(!IsModified()); // should have been committed } void SvtSecurityOptions_Impl::SetProperty( sal_Int32 nProperty, const Any& rValue, bool bRO ) diff --git a/unotools/source/config/syslocaleoptions.cxx b/unotools/source/config/syslocaleoptions.cxx index 5a8d10788056..3ce1851b193c 100644 --- a/unotools/source/config/syslocaleoptions.cxx +++ b/unotools/source/config/syslocaleoptions.cxx @@ -249,8 +249,7 @@ SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl() SvtSysLocaleOptions_Impl::~SvtSysLocaleOptions_Impl() { - if ( IsModified() ) - Commit(); + assert(!IsModified()); // should have been committed } void SvtSysLocaleOptions_Impl::MakeRealLocale() diff --git a/vcl/source/gdi/configsettings.cxx b/vcl/source/gdi/configsettings.cxx index dd5c32757a7f..1e33a4819e89 100644 --- a/vcl/source/gdi/configsettings.cxx +++ b/vcl/source/gdi/configsettings.cxx @@ -53,8 +53,7 @@ SettingsConfigItem::SettingsConfigItem() SettingsConfigItem::~SettingsConfigItem() { - if( IsModified() ) - Commit(); + assert(!IsModified()); // should have been committed } void SettingsConfigItem::ImplCommit() |