summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-08-09 12:32:07 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-08-09 12:47:03 +0100
commit16f75f1f773035df36437763588d5a3acbb70935 (patch)
tree3d35c0f147b6d7889d9f847179785e3cdf2075e5 /sfx2
parent490b51371dede5910fed770fe70fd1870db0fffa (diff)
reduce static_initialization_and_destruction chain
Change-Id: I9fdefd428b858fd5581412d6f8e896a0eb680fef
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/doc/objxtor.cxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index c6e3acdfa98e..a9bb168863c6 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -31,7 +31,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/XTitle.hpp>
#include <osl/mutex.hxx>
-
+#include <rtl/instance.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/wrkwin.hxx>
#include <vcl/svapp.hxx>
@@ -115,7 +115,7 @@ DBG_NAME(SfxObjectShell)
namespace {
-static WeakReference< XInterface > s_xCurrentComponent;
+class theCurrentComponent : public rtl::Static< WeakReference< XInterface >, theCurrentComponent > {};
#ifndef DISABLE_SCRIPTING
@@ -932,7 +932,9 @@ sal_uInt16 SfxObjectShell::GetAutoStyleFilterIndex()
void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComponent )
{
- Reference< XInterface > xOldCurrentComp(s_xCurrentComponent);
+ WeakReference< XInterface >& rTheCurrentComponent = theCurrentComponent::get();
+
+ Reference< XInterface > xOldCurrentComp(rTheCurrentComponent);
if ( _rxComponent == xOldCurrentComp )
// nothing to do
return;
@@ -943,7 +945,7 @@ void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComp
#ifndef DISABLE_SCRIPTING
BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
- s_xCurrentComponent = _rxComponent;
+ rTheCurrentComponent = _rxComponent;
if ( pAppMgr )
{
// set "ThisComponent" for Basic
@@ -975,7 +977,7 @@ void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComp
Reference< XInterface > SfxObjectShell::GetCurrentComponent()
{
- return s_xCurrentComponent;
+ return theCurrentComponent::get();
}