diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-11-26 12:48:26 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-11-26 12:48:26 +0100 |
commit | f902bcda6e769c59231e40a45430b83fc2006199 (patch) | |
tree | 19f84e48dfb63d1478cda54c660190b4ceee4535 /toolkit | |
parent | a1ba48f312e9a5a1c8383775a0f0ef951832f4d4 (diff) |
Make ~Window more robust
...in cases where the Window(WindowType) ctor did not call Window::ImplInit, so
many members are null; if then a derived class's ctor throws an exception,
~Window must be careful not to dereference those null members.
Change-Id: I12c4b1b5d7f3633387b85acf9da6d57c42e793b4
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/source/helper/unowrapper.cxx | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx index 577e3875ac40..d138da4898e5 100644 --- a/toolkit/source/helper/unowrapper.cxx +++ b/toolkit/source/helper/unowrapper.cxx @@ -268,19 +268,22 @@ void UnoWrapper::WindowDestroyed( Window* pWindow ) // ::com::sun::star::chaos::System-Windows suchen... Window* pOverlap = pWindow->GetWindow( WINDOW_OVERLAP ); - pOverlap = pOverlap->GetWindow( WINDOW_FIRSTOVERLAP ); - while ( pOverlap ) + if ( pOverlap ) { - Window* pNextOverlap = pOverlap->GetWindow( WINDOW_NEXT ); - Window* pClient = pOverlap->GetWindow( WINDOW_CLIENT ); - - if ( pClient->GetWindowPeer() && lcl_ImplIsParent( pWindow, pClient ) ) + pOverlap = pOverlap->GetWindow( WINDOW_FIRSTOVERLAP ); + while ( pOverlap ) { - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComp( pClient->GetComponentInterface( sal_False ), ::com::sun::star::uno::UNO_QUERY ); - xComp->dispose(); - } + Window* pNextOverlap = pOverlap->GetWindow( WINDOW_NEXT ); + Window* pClient = pOverlap->GetWindow( WINDOW_CLIENT ); + + if ( pClient->GetWindowPeer() && lcl_ImplIsParent( pWindow, pClient ) ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComp( pClient->GetComponentInterface( sal_False ), ::com::sun::star::uno::UNO_QUERY ); + xComp->dispose(); + } - pOverlap = pNextOverlap; + pOverlap = pNextOverlap; + } } Window* pParent = pWindow->GetParent(); |