summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/inc/tools/solarmutex.hxx45
-rw-r--r--tools/prj/d.lst1
-rw-r--r--tools/source/misc/makefile.mk3
-rw-r--r--tools/source/misc/solarmutex.cxx60
-rw-r--r--unotools/source/config/configitem.cxx37
-rw-r--r--vcl/win/source/app/salinst.cxx2
6 files changed, 122 insertions, 26 deletions
diff --git a/tools/inc/tools/solarmutex.hxx b/tools/inc/tools/solarmutex.hxx
new file mode 100644
index 000000000000..b1166f2b19a5
--- /dev/null
+++ b/tools/inc/tools/solarmutex.hxx
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TOOLS_SOLARMUTEX_HXX
+#define _TOOLS_SOLARMUTEX_HXX
+
+#include "tools/toolsdllapi.h"
+#include <vos/mutex.hxx>
+
+namespace tools
+{
+ class TOOLS_DLLPUBLIC SolarMutex
+ {
+ public:
+ static ::vos::IMutex* GetSolarMutex();
+ static void SetSolarMutex( ::vos::IMutex* pMutex );
+ static bool Acquire();
+ static void Release();
+ };
+};
+
+#endif
diff --git a/tools/prj/d.lst b/tools/prj/d.lst
index e8fde61686a4..c9fa9d2574a4 100644
--- a/tools/prj/d.lst
+++ b/tools/prj/d.lst
@@ -34,6 +34,7 @@ mkdir: %_DEST%\inc%_EXT%\bootstrp
..\inc\tools\postx.h %_DEST%\inc%_EXT%\tools\postx.h
..\inc\tools\prex.h %_DEST%\inc%_EXT%\tools\prex.h
+..\inc\tools\solarmutex.hxx %_DEST%\inc%_EXT%\tools\solarmutex.hxx
..\inc\tools\agapi.hxx %_DEST%\inc%_EXT%\tools\agapi.hxx
..\inc\tools\agapi.hxx %_DEST%\inc%_EXT%\tools\agapi.hxx
..\inc\tools\agitem.hxx %_DEST%\inc%_EXT%\tools\agitem.hxx
diff --git a/tools/source/misc/makefile.mk b/tools/source/misc/makefile.mk
index 7742c471445f..adc098b023b8 100644
--- a/tools/source/misc/makefile.mk
+++ b/tools/source/misc/makefile.mk
@@ -42,9 +42,10 @@ LIB1TARGET = $(SLB)$/$(TARGET).lib
LIB1OBJFILES = \
$(SLO)$/appendunixshellword.obj \
$(SLO)$/extendapplicationenvironment.obj \
+ $(SLO)$/solarmutex.obj \
$(SLO)$/getprocessworkingdir.obj
OBJFILES = $(OBJ)$/pathutils.obj
-SLOFILES = $(SLO)$/pathutils.obj $(LIB1OBJFILES)
+SLOFILES = $(SLO)$/pathutils.obj $(LIB1OBJFILES) $(SLO)$/solarmutex.obj
.INCLUDE: target.mk
diff --git a/tools/source/misc/solarmutex.cxx b/tools/source/misc/solarmutex.cxx
new file mode 100644
index 000000000000..9049c13997a9
--- /dev/null
+++ b/tools/source/misc/solarmutex.cxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_tools.hxx"
+#include <tools/solarmutex.hxx>
+
+namespace tools
+{
+ static ::vos::IMutex* pSolarMutex = 0;
+
+ ::vos::IMutex* SolarMutex::GetSolarMutex()
+ {
+ return pSolarMutex;
+ }
+
+ void SolarMutex::SetSolarMutex( ::vos::IMutex* pMutex )
+ {
+ pSolarMutex = pMutex;
+ }
+
+ bool SolarMutex::Acquire()
+ {
+ if ( pSolarMutex )
+ pSolarMutex->acquire();
+ else
+ return false;
+ return true;
+ }
+
+ void SolarMutex::Release()
+ {
+ if ( pSolarMutex )
+ pSolarMutex->release();
+ }
+}
diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx
index 3170fae25a5d..38aee1b39d16 100644
--- a/unotools/source/config/configitem.cxx
+++ b/unotools/source/config/configitem.cxx
@@ -45,13 +45,12 @@
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/awt/XRequestCallback.hpp>
-#include <com/sun/star/awt/XCallback.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/util/XStringEscape.hpp>
#include <com/sun/star/util/XChangesBatch.hpp>
#include <osl/diagnose.h>
-
+#include <tools/solarmutex.hxx>
#include <rtl/ustrbuf.hxx>
using namespace utl;
@@ -65,7 +64,7 @@ using namespace com::sun::star::container;
using namespace com::sun::star::configuration;
#define C2U(cChar) OUString::createFromAscii(cChar)
-#include <cppuhelper/implbase2.hxx> // helper for implementations
+#include <cppuhelper/implbase1.hxx> // helper for implementations
#ifdef DBG_UTIL
inline void lcl_CFG_DBG_EXCEPTION(const sal_Char* cText, const Exception& rEx)
@@ -85,10 +84,9 @@ catch(Exception& rEx) \
#endif
namespace utl{
- class ConfigChangeListener_Impl : public cppu::WeakImplHelper2
+ class ConfigChangeListener_Impl : public cppu::WeakImplHelper1
<
- com::sun::star::util::XChangesListener,
- com::sun::star::awt::XCallback
+ com::sun::star::util::XChangesListener
>
{
public:
@@ -102,9 +100,6 @@ namespace utl{
//XEventListener
virtual void SAL_CALL disposing( const EventObject& Source ) throw(RuntimeException);
-
- //XAsyncCallback
- virtual void SAL_CALL notify ( const Any& rData ) throw(RuntimeException);
};
/* -----------------------------12.02.01 11:38--------------------------------
@@ -214,28 +209,23 @@ void ConfigChangeListener_Impl::changesOccurred( const ChangesEvent& rEvent ) th
if(lcl_Find(sTemp, pCheckPropertyNames, aPropertyNames.getLength()))
pNames[nNotify++] = sTemp;
}
- if(nNotify)
+ if( nNotify )
{
- aChangedNames.realloc(nNotify);
- Reference < com::sun::star::awt::XRequestCallback > aCallback( ::comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.awt.AsyncCallback") ), UNO_QUERY );
- aCallback->addCallback( this, makeAny( aChangedNames ) );
+ if ( ::tools::SolarMutex::Acquire() )
+ {
+ aChangedNames.realloc(nNotify);
+ pParent->CallNotify(aChangedNames);
+ ::tools::SolarMutex::Release();
+ }
}
}
-void ConfigChangeListener_Impl::notify ( const Any& rData ) throw(RuntimeException)
-{
- Sequence<OUString> aChangedNames;
- if ( (rData >>= aChangedNames) && pParent )
- pParent->CallNotify(aChangedNames);
-}
-
/* -----------------------------29.08.00 16:34--------------------------------
---------------------------------------------------------------------------*/
void ConfigChangeListener_Impl::disposing( const EventObject& /*rSource*/ ) throw(RuntimeException)
{
- if ( pParent )
- pParent->RemoveChangesListener();
+ pParent->RemoveChangesListener();
}
/* -----------------------------29.08.00 12:50--------------------------------
@@ -282,9 +272,6 @@ ConfigItem::~ConfigItem()
{
if(pImpl->pManager)
{
- ConfigChangeListener_Impl* pListener = dynamic_cast < ConfigChangeListener_Impl* >( xChangeLstnr.get() );
- if ( pListener )
- pListener->pParent = 0;
RemoveChangesListener();
pImpl->pManager->RemoveConfigItem(*this);
}
diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx
index d57cdd48eed2..6fac71b1513e 100644
--- a/vcl/win/source/app/salinst.cxx
+++ b/vcl/win/source/app/salinst.cxx
@@ -656,6 +656,7 @@ WinSalInstance::WinSalInstance()
{
mhComWnd = 0;
mpSalYieldMutex = new SalYieldMutex( this );
+ ::tools::SolarMutex::SetSolarMutex( mpSalYieldMutex );
mpSalWaitMutex = new vos::OMutex;
mnYieldWaitCount = 0;
mpSalYieldMutex->acquire();
@@ -666,6 +667,7 @@ WinSalInstance::WinSalInstance()
WinSalInstance::~WinSalInstance()
{
mpSalYieldMutex->release();
+ ::tools::SolarMutex::SetSolarMutex( 0 );
delete mpSalYieldMutex;
delete mpSalWaitMutex;
DestroyWindow( mhComWnd );