diff options
-rw-r--r-- | include/vcl/window.hxx | 3 | ||||
-rw-r--r-- | vcl/inc/svdata.hxx | 13 | ||||
-rw-r--r-- | vcl/source/app/svapp.cxx | 34 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 65 |
4 files changed, 15 insertions, 100 deletions
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index bc762f458150..d69de6d57e17 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -591,9 +591,6 @@ public: SAL_DLLPRIVATE void ImplPosSizeWindow( long nX, long nY, long nWidth, long nHeight, PosSizeFlags nFlags ); - SAL_DLLPRIVATE void ImplAddDel( ImplDelData* pDel ) const; - SAL_DLLPRIVATE void ImplRemoveDel( ImplDelData* pDel ) const; - SAL_DLLPRIVATE void ImplCallResize(); SAL_DLLPRIVATE void ImplCallMove(); diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index d139c140edd0..e43b0d4a676d 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -375,19 +375,6 @@ struct ImplDelData ImplDelData* mpNext; VclPtr<vcl::Window> mpWindow; bool mbDel; - - ImplDelData( vcl::Window* pWindow = nullptr ); - virtual ~ImplDelData(); - - bool IsDead() const - { - DBG_ASSERT( !mbDel, "object deleted while in use !" ); - return mbDel; - } - -private: - void AttachToWindow( const vcl::Window* ); - }; struct ImplSVEvent diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index b0d9111eb733..c36b722efef3 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1783,38 +1783,4 @@ void Application::setDeInitHook(Link<LinkParamNone*,void> const & hook) { pSVData->maAppData.mbInAppMain = true; } -ImplDelData::ImplDelData( vcl::Window* pWindow ) : - mpNext( nullptr ), - mpWindow( nullptr ), - mbDel( false ) -{ - if( pWindow ) AttachToWindow( pWindow ); -} - -// helper method to allow inline constructor even for pWindow!=NULL case -void ImplDelData::AttachToWindow( const vcl::Window* pWindow ) -{ - if( pWindow ) - { - if( pWindow->IsDisposed() ) - mbDel = true; - else - pWindow->ImplAddDel( this ); - } -} - -// define dtor for ImplDelData -ImplDelData::~ImplDelData() -{ - // #112873# auto remove of ImplDelData - // due to this code actively calling ImplRemoveDel() is not mandatory anymore - if( !mbDel && mpWindow ) - { - // the window still exists but we were not removed - mpWindow.get()->ImplRemoveDel( this ); - mpWindow = nullptr; - } -} - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 3489e0d1413d..a6c4fc8d4d30 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -1377,41 +1377,6 @@ void Window::ImplSetReallyVisible() } } -void Window::ImplAddDel( ImplDelData* pDel ) const -{ - if ( IsDisposed() ) - { - pDel->mbDel = true; - return; - } - - DBG_ASSERT( !pDel->mpWindow, "Window::ImplAddDel(): cannot add ImplDelData twice !" ); - if( !pDel->mpWindow ) - { - pDel->mpWindow = const_cast<vcl::Window*>(this); // #112873# store ref to this window, so pDel can remove itself - pDel->mpNext = mpWindowImpl->mpFirstDel; - mpWindowImpl->mpFirstDel = pDel; - } -} - -void Window::ImplRemoveDel( ImplDelData* pDel ) const -{ - pDel->mpWindow = nullptr; // #112873# pDel is not associated with a Window anymore - - if ( IsDisposed() ) - return; - - if ( mpWindowImpl->mpFirstDel == pDel ) - mpWindowImpl->mpFirstDel = pDel->mpNext; - else - { - ImplDelData* pData = mpWindowImpl->mpFirstDel; - while ( pData->mpNext != pDel ) - pData = pData->mpNext; - pData->mpNext = pDel->mpNext; - } -} - void Window::ImplInitResolutionSettings() { // recalculate AppFont-resolution and DPI-resolution @@ -1949,9 +1914,9 @@ void Window::GetFocus() { if ( HasFocus() && mpWindowImpl->mpLastFocusWindow && !(mpWindowImpl->mnDlgCtrlFlags & DialogControlFlags::WantFocus) ) { - ImplDelData aDogtag( this ); + VclPtr<vcl::Window> xWindow(this); mpWindowImpl->mpLastFocusWindow->GrabFocus(); - if( aDogtag.IsDead() ) + if( xWindow->IsDisposed() ) return; } @@ -2296,7 +2261,7 @@ void Window::Show(bool bVisible, ShowFlags nFlags) if ( IsDisposed() || mpWindowImpl->mbVisible == bVisible ) return; - ImplDelData aDogTag( this ); + VclPtr<vcl::Window> xWindow(this); bool bRealVisibilityChanged = false; mpWindowImpl->mbVisible = bVisible; @@ -2304,7 +2269,7 @@ void Window::Show(bool bVisible, ShowFlags nFlags) if ( !bVisible ) { ImplHideAllOverlaps(); - if( aDogTag.IsDead() ) + if( xWindow->IsDisposed() ) return; if ( mpWindowImpl->mpBorderWindow ) @@ -2330,7 +2295,7 @@ void Window::Show(bool bVisible, ShowFlags nFlags) vcl::Region aInvRegion = mpWindowImpl->maWinClipRegion; - if( aDogTag.IsDead() ) + if( xWindow->IsDisposed() ) return; bRealVisibilityChanged = mpWindowImpl->mbReallyVisible; @@ -2463,7 +2428,7 @@ void Window::Show(bool bVisible, ShowFlags nFlags) bool bNoActivate(nFlags & (ShowFlags::NoActivate|ShowFlags::NoFocusChange)); mpWindowImpl->mpFrame->Show( true, bNoActivate ); } - if( aDogTag.IsDead() ) + if( xWindow->IsDisposed() ) return; // Query the correct size of the window, if we are waiting for @@ -2481,13 +2446,13 @@ void Window::Show(bool bVisible, ShowFlags nFlags) mpWindowImpl->mpFrameData->mpBuffer->SetOutputSizePixel(GetOutputSizePixel()); } - if( aDogTag.IsDead() ) + if( xWindow->IsDisposed() ) return; ImplShowAllOverlaps(); } - if( aDogTag.IsDead() ) + if( xWindow->IsDisposed() ) return; // the SHOW/HIDE events also serve as indicators to send child creation/destroy events to the access bridge @@ -2497,7 +2462,7 @@ void Window::Show(bool bVisible, ShowFlags nFlags) // now only notify with a NULL data pointer, for all other clients except the access bridge. if ( !bRealVisibilityChanged ) CallEventListeners( mpWindowImpl->mbVisible ? VCLEVENT_WINDOW_SHOW : VCLEVENT_WINDOW_HIDE ); - if( aDogTag.IsDead() ) + if( xWindow->IsDisposed() ) return; } @@ -2513,10 +2478,10 @@ Size Window::GetSizePixel() const // #i43257# trigger pending resize handler to assure correct window sizes if( mpWindowImpl->mpFrameData->maResizeIdle.IsActive() ) { - ImplDelData aDogtag( const_cast<Window*>(this) ); + VclPtr<vcl::Window> xWindow( const_cast<Window*>(this) ); mpWindowImpl->mpFrameData->maResizeIdle.Stop(); mpWindowImpl->mpFrameData->maResizeIdle.GetIdleHdl().Call( nullptr ); - if( aDogtag.IsDead() ) + if( xWindow->IsDisposed() ) return Size(0,0); } @@ -3300,9 +3265,9 @@ void Window::ImplCallDeactivateListeners( vcl::Window *pNew ) // no deactivation if the newly activated window is my child if ( !pNew || !ImplIsChild( pNew ) ) { - ImplDelData aDogtag( this ); + VclPtr<vcl::Window> xWindow(this); CallEventListeners( VCLEVENT_WINDOW_DEACTIVATE ); - if( aDogtag.IsDead() ) + if( xWindow->IsDisposed() ) return; // #100759#, avoid walking the wrong frame's hierarchy @@ -3317,9 +3282,9 @@ void Window::ImplCallActivateListeners( vcl::Window *pOld ) // no activation if the old active window is my child if ( !pOld || !ImplIsChild( pOld ) ) { - ImplDelData aDogtag( this ); + VclPtr<vcl::Window> xWindow(this); CallEventListeners( VCLEVENT_WINDOW_ACTIVATE, pOld ); - if( aDogtag.IsDead() ) + if( xWindow->IsDisposed() ) return; if ( ImplGetParent() ) |