diff options
author | Tobias Lippert <drtl@fastmail.fm> | 2014-01-11 21:03:11 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-02-21 15:38:03 +0000 |
commit | a9cfb745c5ade8b05b97a33c4cb5cc66941b803d (patch) | |
tree | 7fc25639ae12358bebf6f36ae9c586729243fc1e /include/vcl/settings.hxx | |
parent | 441ef2e9c6e72ea8ae47c707cc29d1cd068a47a1 (diff) |
Replace handwritten reference counting with shared_ptr
This will help to avoid race conditions because the shared pointers
are thread safe and use atomic increments.
Conflicts:
include/vcl/settings.hxx
vcl/source/app/settings.cxx
Change-Id: Ie3d27d6412167855a0cea1442676b81b733c15e8
Diffstat (limited to 'include/vcl/settings.hxx')
-rw-r--r-- | include/vcl/settings.hxx | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx index 0173b31ca240..828c7a1105ff 100644 --- a/include/vcl/settings.hxx +++ b/include/vcl/settings.hxx @@ -30,6 +30,8 @@ #include <i18nlangtag/languagetag.hxx> #include <unotools/syslocale.hxx> +#include <boost/shared_ptr.hpp> + class CollatorWrapper; class LocaleDataWrapper; @@ -44,12 +46,11 @@ namespace vcl { class ImplMouseData { friend class MouseSettings; - +public: ImplMouseData(); ImplMouseData( const ImplMouseData& rData ); private: - sal_uLong mnRefCount; sal_uLong mnOptions; sal_uLong mnDoubleClkTime; long mnDoubleClkWidth; @@ -97,7 +98,7 @@ class VCL_DLLPUBLIC MouseSettings void CopyData(); private: - ImplMouseData* mpData; + boost::shared_ptr<ImplMouseData> mpData; public: MouseSettings(); @@ -241,13 +242,12 @@ class ImplStyleData { friend class StyleSettings; +public: ImplStyleData(); ImplStyleData( const ImplStyleData& rData ); - void SetStandardStyles(); private: - sal_uLong mnRefCount; - + void SetStandardStyles(); Color maActiveBorderColor; Color maActiveColor; Color maActiveColor2; @@ -434,7 +434,7 @@ class VCL_DLLPUBLIC StyleSettings void CopyData(); private: - ImplStyleData* mpData; + boost::shared_ptr<ImplStyleData> mpData; public: StyleSettings(); @@ -833,8 +833,8 @@ public: void SetOptions( sal_uLong nOptions ) { CopyData(); mpData->mnOptions = nOptions; } - sal_uLong GetOptions() const - { return mpData->mnOptions; } + sal_uLong GetOptions() const; + void SetAutoMnemonic( bool bAutoMnemonic ) { CopyData(); mpData->mnAutoMnemonic = (sal_uInt16)bAutoMnemonic; } bool GetAutoMnemonic() const @@ -958,15 +958,15 @@ protected: class ImplMiscData { friend class MiscSettings; +public: ImplMiscData(); ImplMiscData( const ImplMiscData& rData ); private: - sal_uLong mnRefCount; - AutoState mnEnableATT; + AutoState mnEnableATT; bool mbEnableLocalizedDecimalSep; - AutoState mnDisablePrinting; + AutoState mnDisablePrinting; }; // ---------------- @@ -978,7 +978,7 @@ class VCL_DLLPUBLIC MiscSettings void CopyData(); private: - ImplMiscData* mpData; + boost::shared_ptr<ImplMiscData> mpData; public: MiscSettings(); @@ -1006,12 +1006,11 @@ public: class ImplHelpData { friend class HelpSettings; - +public: ImplHelpData(); ImplHelpData( const ImplHelpData& rData ); private: - sal_uLong mnRefCount; sal_uLong mnOptions; sal_uLong mnTipDelay; sal_uLong mnTipTimeout; @@ -1027,7 +1026,7 @@ class VCL_DLLPUBLIC HelpSettings void CopyData(); private: - ImplHelpData* mpData; + boost::shared_ptr<ImplHelpData> mpData; public: HelpSettings(); @@ -1063,14 +1062,13 @@ public: // ----------------------- class ImplAllSettingsData { - friend class AllSettings; - - ImplAllSettingsData(); - ImplAllSettingsData( const ImplAllSettingsData& rData ); - ~ImplAllSettingsData(); +public: + ImplAllSettingsData(); + ImplAllSettingsData( const ImplAllSettingsData& rData ); + ~ImplAllSettingsData(); + friend class AllSettings; private: - sal_uLong mnRefCount; MouseSettings maMouseSettings; StyleSettings maStyleSettings; MiscSettings maMiscSettings; @@ -1111,7 +1109,7 @@ class VCL_DLLPUBLIC AllSettings void CopyData(); private: - ImplAllSettingsData* mpData; + boost::shared_ptr<ImplAllSettingsData> mpData; public: AllSettings(); @@ -1125,8 +1123,7 @@ public: void SetStyleSettings( const StyleSettings& rSet ) { CopyData(); mpData->maStyleSettings = rSet; } - const StyleSettings& GetStyleSettings() const - { return mpData->maStyleSettings; } + const StyleSettings& GetStyleSettings() const; void SetMiscSettings( const MiscSettings& rSet ) { CopyData(); mpData->maMiscSettings = rSet; } |