summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2010-10-05 15:49:42 +0200
committerLuboš Luňák <l.lunak@suse.cz>2010-10-05 16:02:51 +0200
commitb250344e88434741d4fae99a7ef198c46e020132 (patch)
treef41adc410ceb655ad260bbbb7108a4563c6999e8
parentc1d5ee0970e7c5ad2ac8091a075b61ad0aab1408 (diff)
refactor several SolarMutex releaser classes into one
-rw-r--r--svtools/source/contnr/fileview.cxx21
-rw-r--r--toolkit/source/awt/vclxwindow.cxx2
-rw-r--r--vcl/inc/vcl/svapp.hxx20
-rw-r--r--vcl/source/helper/xconnection.cxx19
4 files changed, 22 insertions, 40 deletions
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index af19379d8b8f..f6c4dc01434e 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -109,25 +109,6 @@ DECLARE_LIST( StringList_Impl, OUString* )
namespace
{
//====================================================================
- //= ReleaseSolarMutex
- //====================================================================
- struct ReleaseSolarMutex
- {
- private:
- ULONG m_nCount;
-
- public:
- inline ReleaseSolarMutex()
- {
- m_nCount = Application::ReleaseSolarMutex();
- }
- inline ~ReleaseSolarMutex()
- {
- Application::AcquireSolarMutex( m_nCount );
- }
- };
-
- //====================================================================
//= ITimeoutHandler
//====================================================================
class CallbackTimer;
@@ -2022,7 +2003,7 @@ FileViewResult SvtFileView_Impl::GetFolderContent_Impl(
// also release the SolarMutex. Not all code which is needed during the enumeration
// is Solar-Thread-Safe, in particular there is some code which needs to access
// string resources (and our resource system relies on the SolarMutex :()
- ReleaseSolarMutex aSolarRelease;
+ SolarMutexReleaser aSolarRelease;
// now wait. Note that if we didn't get an pAsyncDescriptor, then this is an infinite wait.
eResult = m_aAsyncActionFinished.wait( pTimeout.get() );
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
index efc2c40c6baa..3e798c3f0ecd 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -339,7 +339,7 @@ IMPL_LINK( VCLXWindowImpl, OnProcessCallbacks, void*, EMPTYARG )
}
{
- ::toolkit::ReleaseSolarMutex aReleaseSolar;
+ SolarMutexReleaser aReleaseSolar;
for ( CallbackArray::const_iterator loop = aCallbacksCopy.begin();
loop != aCallbacksCopy.end();
++loop
diff --git a/vcl/inc/vcl/svapp.hxx b/vcl/inc/vcl/svapp.hxx
index f90326ce50eb..8dbbe5221434 100644
--- a/vcl/inc/vcl/svapp.hxx
+++ b/vcl/inc/vcl/svapp.hxx
@@ -498,6 +498,26 @@ private:
DECL_STATIC_LINK( Application, PostEventHandler, void* );
};
+/**
+ A helper class that calls Application::ReleaseSolarMutex() in its constructor
+ and restores the mutex in its destructor.
+*/
+class SolarMutexReleaser
+{
+ ULONG mnReleased;
+public:
+ SolarMutexReleaser()
+ {
+ mnReleased = Application::ReleaseSolarMutex();
+ }
+
+ ~SolarMutexReleaser()
+ {
+ if( mnReleased )
+ Application::AcquireSolarMutex( mnReleased );
+ }
+};
+
VCL_DLLPUBLIC Application* GetpApp();
VCL_DLLPUBLIC BOOL InitVCL( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & );
diff --git a/vcl/source/helper/xconnection.cxx b/vcl/source/helper/xconnection.cxx
index caf7ee237d67..c15e368d3791 100644
--- a/vcl/source/helper/xconnection.cxx
+++ b/vcl/source/helper/xconnection.cxx
@@ -34,25 +34,6 @@
#include "vcl/salinst.hxx"
#include "vcl/svapp.hxx"
-namespace vcl
-{
- class SolarMutexReleaser
- {
- ULONG mnReleased;
- public:
- SolarMutexReleaser()
- {
- mnReleased = Application::ReleaseSolarMutex();
- }
-
- ~SolarMutexReleaser()
- {
- if( mnReleased )
- Application::AcquireSolarMutex( mnReleased );
- }
- };
-}
-
using namespace rtl;
using namespace osl;
using namespace vcl;