summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Driesner <cd@openoffice.org>2011-02-28 10:00:23 +0100
committerCarsten Driesner <cd@openoffice.org>2011-02-28 10:00:23 +0100
commit20755856d6007b9f4316c6ba2a571b26d0de85da (patch)
tree750f24ca3a12ae75b70917298a0352f80802449a
parent471c2f552f7b1410b9b44ef4d0861fa2059d6315 (diff)
fwk167: #i70217 No need to assert if the same instance is set. Don't create a fresh VCLXDialog instance if has been created in the window ctor
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx9
-rw-r--r--toolkit/source/helper/unowrapper.cxx10
2 files changed, 14 insertions, 5 deletions
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index dd6e28807bc6..1c2df22e56a7 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -786,7 +786,14 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
if ( (pParent == NULL ) && ( rDescriptor.ParentIndex == -1 ) )
pParent = DIALOG_NO_PARENT;
pNewWindow = new Dialog( pParent, nWinBits );
- *ppNewComp = new VCLXDialog;
+ // #i70217# Don't always create a new component object. It's possible that VCL has called
+ // GetComponentInterface( sal_True ) in the Dialog ctor itself (see Window::IsTopWindow() )
+ // which creates a component object.
+ css::uno::Reference< css::awt::XWindowPeer > xWinPeer = pNewWindow->GetComponentInterface( sal_False );
+ if ( xWinPeer.is() )
+ *ppNewComp = dynamic_cast< VCLXDialog* >( xWinPeer.get() );
+ else
+ *ppNewComp = new VCLXDialog;
}
break;
case WINDOW_MOREBUTTON:
diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx
index 1b676ec0edb3..7046f9485d36 100644
--- a/toolkit/source/helper/unowrapper.cxx
+++ b/toolkit/source/helper/unowrapper.cxx
@@ -180,11 +180,13 @@ void UnoWrapper::SetWindowInterface( Window* pWindow, ::com::sun::star::uno::Ref
DBG_ASSERT( pVCLXWindow, "SetComponentInterface - unsupported type" );
if ( pVCLXWindow )
{
- if( pWindow->GetWindowPeer() )
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xPeer = pWindow->GetWindowPeer();
+ if( xPeer.is() )
{
- int i = 0;
- i++;
- // DBG_ERROR( "UnoWrapper::SetWindowInterface: there already *is* a WindowInterface for this window!" );
+ bool bSameInstance( pVCLXWindow == dynamic_cast< VCLXWindow* >( xPeer.get() ));
+ DBG_ASSERT( bSameInstance, "UnoWrapper::SetWindowInterface: there already *is* a WindowInterface for this window!" );
+ if ( bSameInstance )
+ return;
}
pVCLXWindow->SetWindow( pWindow );
pWindow->SetWindowPeer( xIFace, pVCLXWindow );