Kaydet (Commit) a9cfb745 authored tarafından Tobias Lippert's avatar Tobias Lippert Kaydeden (comit) Caolán McNamara

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
üst 441ef2e9
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#include <i18nlangtag/languagetag.hxx> #include <i18nlangtag/languagetag.hxx>
#include <unotools/syslocale.hxx> #include <unotools/syslocale.hxx>
#include <boost/shared_ptr.hpp>
class CollatorWrapper; class CollatorWrapper;
class LocaleDataWrapper; class LocaleDataWrapper;
...@@ -44,12 +46,11 @@ namespace vcl { ...@@ -44,12 +46,11 @@ namespace vcl {
class ImplMouseData class ImplMouseData
{ {
friend class MouseSettings; friend class MouseSettings;
public:
ImplMouseData(); ImplMouseData();
ImplMouseData( const ImplMouseData& rData ); ImplMouseData( const ImplMouseData& rData );
private: private:
sal_uLong mnRefCount;
sal_uLong mnOptions; sal_uLong mnOptions;
sal_uLong mnDoubleClkTime; sal_uLong mnDoubleClkTime;
long mnDoubleClkWidth; long mnDoubleClkWidth;
...@@ -97,7 +98,7 @@ class VCL_DLLPUBLIC MouseSettings ...@@ -97,7 +98,7 @@ class VCL_DLLPUBLIC MouseSettings
void CopyData(); void CopyData();
private: private:
ImplMouseData* mpData; boost::shared_ptr<ImplMouseData> mpData;
public: public:
MouseSettings(); MouseSettings();
...@@ -241,13 +242,12 @@ class ImplStyleData ...@@ -241,13 +242,12 @@ class ImplStyleData
{ {
friend class StyleSettings; friend class StyleSettings;
public:
ImplStyleData(); ImplStyleData();
ImplStyleData( const ImplStyleData& rData ); ImplStyleData( const ImplStyleData& rData );
void SetStandardStyles();
private: private:
sal_uLong mnRefCount; void SetStandardStyles();
Color maActiveBorderColor; Color maActiveBorderColor;
Color maActiveColor; Color maActiveColor;
Color maActiveColor2; Color maActiveColor2;
...@@ -434,7 +434,7 @@ class VCL_DLLPUBLIC StyleSettings ...@@ -434,7 +434,7 @@ class VCL_DLLPUBLIC StyleSettings
void CopyData(); void CopyData();
private: private:
ImplStyleData* mpData; boost::shared_ptr<ImplStyleData> mpData;
public: public:
StyleSettings(); StyleSettings();
...@@ -833,8 +833,8 @@ public: ...@@ -833,8 +833,8 @@ public:
void SetOptions( sal_uLong nOptions ) void SetOptions( sal_uLong nOptions )
{ CopyData(); mpData->mnOptions = nOptions; } { CopyData(); mpData->mnOptions = nOptions; }
sal_uLong GetOptions() const sal_uLong GetOptions() const;
{ return mpData->mnOptions; }
void SetAutoMnemonic( bool bAutoMnemonic ) void SetAutoMnemonic( bool bAutoMnemonic )
{ CopyData(); mpData->mnAutoMnemonic = (sal_uInt16)bAutoMnemonic; } { CopyData(); mpData->mnAutoMnemonic = (sal_uInt16)bAutoMnemonic; }
bool GetAutoMnemonic() const bool GetAutoMnemonic() const
...@@ -958,15 +958,15 @@ protected: ...@@ -958,15 +958,15 @@ protected:
class ImplMiscData class ImplMiscData
{ {
friend class MiscSettings; friend class MiscSettings;
public:
ImplMiscData(); ImplMiscData();
ImplMiscData( const ImplMiscData& rData ); ImplMiscData( const ImplMiscData& rData );
private: private:
sal_uLong mnRefCount; AutoState mnEnableATT;
AutoState mnEnableATT;
bool mbEnableLocalizedDecimalSep; bool mbEnableLocalizedDecimalSep;
AutoState mnDisablePrinting; AutoState mnDisablePrinting;
}; };
// ---------------- // ----------------
...@@ -978,7 +978,7 @@ class VCL_DLLPUBLIC MiscSettings ...@@ -978,7 +978,7 @@ class VCL_DLLPUBLIC MiscSettings
void CopyData(); void CopyData();
private: private:
ImplMiscData* mpData; boost::shared_ptr<ImplMiscData> mpData;
public: public:
MiscSettings(); MiscSettings();
...@@ -1006,12 +1006,11 @@ public: ...@@ -1006,12 +1006,11 @@ public:
class ImplHelpData class ImplHelpData
{ {
friend class HelpSettings; friend class HelpSettings;
public:
ImplHelpData(); ImplHelpData();
ImplHelpData( const ImplHelpData& rData ); ImplHelpData( const ImplHelpData& rData );
private: private:
sal_uLong mnRefCount;
sal_uLong mnOptions; sal_uLong mnOptions;
sal_uLong mnTipDelay; sal_uLong mnTipDelay;
sal_uLong mnTipTimeout; sal_uLong mnTipTimeout;
...@@ -1027,7 +1026,7 @@ class VCL_DLLPUBLIC HelpSettings ...@@ -1027,7 +1026,7 @@ class VCL_DLLPUBLIC HelpSettings
void CopyData(); void CopyData();
private: private:
ImplHelpData* mpData; boost::shared_ptr<ImplHelpData> mpData;
public: public:
HelpSettings(); HelpSettings();
...@@ -1063,14 +1062,13 @@ public: ...@@ -1063,14 +1062,13 @@ public:
// ----------------------- // -----------------------
class ImplAllSettingsData class ImplAllSettingsData
{ {
friend class AllSettings; public:
ImplAllSettingsData();
ImplAllSettingsData(); ImplAllSettingsData( const ImplAllSettingsData& rData );
ImplAllSettingsData( const ImplAllSettingsData& rData ); ~ImplAllSettingsData();
~ImplAllSettingsData();
friend class AllSettings;
private: private:
sal_uLong mnRefCount;
MouseSettings maMouseSettings; MouseSettings maMouseSettings;
StyleSettings maStyleSettings; StyleSettings maStyleSettings;
MiscSettings maMiscSettings; MiscSettings maMiscSettings;
...@@ -1111,7 +1109,7 @@ class VCL_DLLPUBLIC AllSettings ...@@ -1111,7 +1109,7 @@ class VCL_DLLPUBLIC AllSettings
void CopyData(); void CopyData();
private: private:
ImplAllSettingsData* mpData; boost::shared_ptr<ImplAllSettingsData> mpData;
public: public:
AllSettings(); AllSettings();
...@@ -1125,8 +1123,7 @@ public: ...@@ -1125,8 +1123,7 @@ public:
void SetStyleSettings( const StyleSettings& rSet ) void SetStyleSettings( const StyleSettings& rSet )
{ CopyData(); mpData->maStyleSettings = rSet; } { CopyData(); mpData->maStyleSettings = rSet; }
const StyleSettings& GetStyleSettings() const const StyleSettings& GetStyleSettings() const;
{ return mpData->maStyleSettings; }
void SetMiscSettings( const MiscSettings& rSet ) void SetMiscSettings( const MiscSettings& rSet )
{ CopyData(); mpData->maMiscSettings = rSet; } { CopyData(); mpData->maMiscSettings = rSet; }
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment