summaryrefslogtreecommitdiff
path: root/starmath/source/viewhdl.cxx
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2006-01-31 17:34:17 +0000
committerKurt Zenker <kz@openoffice.org>2006-01-31 17:34:17 +0000
commit2e57a73bad6a97aea8c92d57a18c2394e35a5901 (patch)
tree0e1f14bd48d1d0712967a2ca050f08f3a258c0ac /starmath/source/viewhdl.cxx
parent57d456b92b4437343564c3299cc11df861b3b0c6 (diff)
INTEGRATION: CWS tl17 (1.6.40); FILE MERGED
2006/01/02 13:55:37 tl 1.6.40.2: #120812# code for clipboard listener improved 2006/01/02 13:50:35 tl 1.6.40.1: #120812# code for clipboard listener improved
Diffstat (limited to 'starmath/source/viewhdl.cxx')
-rw-r--r--starmath/source/viewhdl.cxx39
1 files changed, 27 insertions, 12 deletions
diff --git a/starmath/source/viewhdl.cxx b/starmath/source/viewhdl.cxx
index 72f184a5107d..bab28089ee34 100644
--- a/starmath/source/viewhdl.cxx
+++ b/starmath/source/viewhdl.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: viewhdl.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: rt $ $Date: 2005-09-07 15:15:43 $
+ * last change: $Author: kz $ $Date: 2006-01-31 18:34:17 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -111,21 +111,32 @@ void SAL_CALL SmClipboardChangeListener::disposing(
void SAL_CALL SmClipboardChangeListener::changedContents(
const ClipboardEvent& rEventObject ) throw ( ::com::sun::star::uno::RuntimeException)
{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
if( pView )
{
{
- const ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
- TransferableDataHelper aDataHelper( rEventObject.Contents );
- pView->bPasteState = aDataHelper.GetTransferable().is() &&
- ( aDataHelper.HasFormat( FORMAT_STRING ) ||
- aDataHelper.HasFormat( SOT_FORMATSTR_ID_EMBEDDED_OBJ ) ||
- (aDataHelper.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR )
- && aDataHelper.HasFormat( SOT_FORMATSTR_ID_EMBED_SOURCE )));
+ TransferableDataHelper aDataHelper( rEventObject.Contents );
+ sal_Bool bHasTransferable = aDataHelper.GetTransferable().is();
+
+ //! according to CD the above call to GetTransferable may create a (new)
+ //! message loop and thus result in re-entrant code.
+ //! Thus it was suggested to check 'pView' here again.
+ if (pView)
+ {
+ pView->bPasteState = bHasTransferable &&
+ ( aDataHelper.HasFormat( FORMAT_STRING ) ||
+ aDataHelper.HasFormat( SOT_FORMATSTR_ID_EMBEDDED_OBJ ) ||
+ (aDataHelper.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR )
+ && aDataHelper.HasFormat( SOT_FORMATSTR_ID_EMBED_SOURCE )));
+ }
}
- SfxBindings& rBind = pView->GetViewFrame()->GetBindings();
- rBind.Invalidate( SID_PASTE );
+ if (pView)
+ {
+ SfxBindings& rBind = pView->GetViewFrame()->GetBindings();
+ rBind.Invalidate( SID_PASTE );
+ }
}
}
@@ -161,6 +172,10 @@ void SmClipboardChangeListener::AddRemoveListener( BOOL bAdd )
void SmViewShell::AddRemoveClipboardListener( BOOL bAdd )
{
+ // AddRemoveListener and ViewDestroyed below should be an
+ // atomic operation and must not be 'interrupted' by other code
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
if( bAdd && !xClipEvtLstnr.is() )
{
xClipEvtLstnr = pClipEvtLstnr = new SmClipboardChangeListener( *this );