diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-10-12 15:42:59 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-10-16 09:54:13 +0200 |
commit | 8a2f7704cd0e43304e54bf2281232335cc0979a3 (patch) | |
tree | a8357d52e613dbff7bd4b6097f75be6871863ce6 /vcl | |
parent | 7dc9fb33db45c269fece6cfec993b124491c68f6 (diff) |
drop LazyDeletor
Change-Id: I7d2e00466f321994a46b0529d645e342f229c929
Reviewed-on: https://gerrit.libreoffice.org/61718
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/README.lifecycle | 2 | ||||
-rw-r--r-- | vcl/source/app/svapp.cxx | 11 | ||||
-rw-r--r-- | vcl/source/helper/lazydelete.cxx | 35 | ||||
-rw-r--r-- | vcl/source/window/menu.cxx | 8 | ||||
-rw-r--r-- | vcl/source/window/menubarwindow.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/menufloatingwindow.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 14 | ||||
-rw-r--r-- | vcl/source/window/window2.cxx | 4 |
8 files changed, 17 insertions, 65 deletions
diff --git a/vcl/README.lifecycle b/vcl/README.lifecycle index 732b1908d077..dc6286210780 100644 --- a/vcl/README.lifecycle +++ b/vcl/README.lifecycle @@ -189,7 +189,7 @@ ways and often both. ---------- What remains to be done ? ---------- - * Cleanup DogTags and LazyDelete. + * Cleanup DogTags * Expand the VclPtr pattern to many other less than safe VCL types. diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 2cd32996be86..a43b830ded2b 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -458,10 +458,9 @@ static bool ImplYield(bool i_bWait, bool i_bAllEvents) SAL_INFO("vcl.schedule", "Enter ImplYield: " << (i_bWait ? "wait" : "no wait") << ": " << (i_bAllEvents ? "all events" : "one event")); - // TODO: there's a data race here on WNT only because ImplYield may be - // called without SolarMutex; if we can get rid of LazyDelete (with VclPtr) - // then the only remaining use of mnDispatchLevel is in OSX specific code - // so that would effectively eliminate the race on WNT + // there's a data race here on WNT only because ImplYield may be + // called without SolarMutex; but the only remaining use of mnDispatchLevel + // is in OSX specific code pSVData->maAppData.mnDispatchLevel++; // do not wait for events if application was already quit; in that @@ -473,10 +472,6 @@ static bool ImplYield(bool i_bWait, bool i_bAllEvents) DBG_TESTSOLARMUTEX(); // must be locked on return from Yield - // flush lazy deleted objects - if( pSVData->maAppData.mnDispatchLevel == 0 ) - vcl::LazyDelete::flush(); - SAL_INFO("vcl.schedule", "Leave ImplYield with return " << bProcessedEvent ); return bProcessedEvent; } diff --git a/vcl/source/helper/lazydelete.cxx b/vcl/source/helper/lazydelete.cxx index 05e1eef56d92..05c6a316a789 100644 --- a/vcl/source/helper/lazydelete.cxx +++ b/vcl/source/helper/lazydelete.cxx @@ -25,41 +25,6 @@ namespace vcl { -LazyDeletorBase::LazyDeletorBase() -{ -} - -LazyDeletorBase::~LazyDeletorBase() -{ -} - -// instantiate instance pointer for LazyDeletor<Window> -LazyDeletor* LazyDeletor::s_pOneInstance = nullptr; - -// a list for all LazyeDeletor<T> singletons -static std::vector< LazyDeletorBase* > lcl_aDeletors; - -void LazyDelete::addDeletor( LazyDeletorBase* i_pDel ) -{ - lcl_aDeletors.push_back( i_pDel ); -} - -void LazyDelete::flush() -{ - DBG_TESTSOLARMUTEX(); // must be locked - - unsigned int nCount = lcl_aDeletors.size(); - for( unsigned int i = 0; i < nCount; i++ ) - delete lcl_aDeletors[i]; - lcl_aDeletors.clear(); -} - -// specialized is_less function for Window -bool LazyDeletor::is_less( vcl::Window const * left, vcl::Window const * right ) -{ - return left != right && right->IsChild( left, true ); -} - DeleteOnDeinitBase::~DeleteOnDeinitBase() { ImplSVData* pSVData = ImplGetSVData(); diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 686694e8e0c0..699ba937ee95 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2952,8 +2952,8 @@ sal_uInt16 PopupMenu::ImplExecute( const VclPtr<vcl::Window>& pW, const tools::R { pWin->StopExecute(); pWin->doShutdown(); - pWindow->doLazyDelete(); - pWindow = nullptr; + pWindow->SetParentToDefaultWindow(); + pWindow.disposeAndClear(); ImplClosePopupToolBox(pW); ImplFlushPendingSelect(); return nSelectedId; @@ -3013,8 +3013,8 @@ sal_uInt16 PopupMenu::ImplExecute( const VclPtr<vcl::Window>& pW, const tools::R } } pWin->doShutdown(); - pWindow->doLazyDelete(); - pWindow = nullptr; + pWindow->SetParentToDefaultWindow(); + pWindow.disposeAndClear(); ImplClosePopupToolBox(pW); ImplFlushPendingSelect(); } diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx index 6fbb4af4eac3..a4c33051046b 100644 --- a/vcl/source/window/menubarwindow.cxx +++ b/vcl/source/window/menubarwindow.cxx @@ -377,8 +377,8 @@ void MenuBarWindow::KillActivePopup() } pActivePopup->ImplGetFloatingWindow()->StopExecute(); pActivePopup->ImplGetFloatingWindow()->doShutdown(); - pActivePopup->pWindow->doLazyDelete(); - pActivePopup->pWindow = nullptr; + pActivePopup->pWindow->SetParentToDefaultWindow(); + pActivePopup->pWindow.disposeAndClear(); } pActivePopup = nullptr; } diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx index 67d6d0ce3a8e..38bb20301bef 100644 --- a/vcl/source/window/menufloatingwindow.cxx +++ b/vcl/source/window/menufloatingwindow.cxx @@ -473,8 +473,8 @@ void MenuFloatingWindow::KillActivePopup( PopupMenu* pThisOnly ) { pPopup->ImplGetFloatingWindow()->StopExecute(); pPopup->ImplGetFloatingWindow()->doShutdown(); - pPopup->pWindow->doLazyDelete(); - pPopup->pWindow = nullptr; + pPopup->pWindow->SetParentToDefaultWindow(); + pPopup->pWindow.disposeAndClear(); Update(); } diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 7f229a94eddc..3c1c0aac5f27 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -571,8 +571,6 @@ void Window::dispose() Window::~Window() { - // FIXME: we should kill all LazyDeletor usage. - vcl::LazyDeletor::Undelete( this ); disposeOnce(); } @@ -1758,16 +1756,10 @@ void Window::ImplNewInputContext() pFocusWin->ImplGetFrame()->SetInputContext( &aNewContext ); } -void Window::doLazyDelete() +void Window::SetParentToDefaultWindow() { - SystemWindow* pSysWin = dynamic_cast<SystemWindow*>(this); - DockingWindow* pDockWin = dynamic_cast<DockingWindow*>(this); - if( pSysWin || ( pDockWin && pDockWin->IsFloatingMode() ) ) - { - Show( false ); - SetParent( ImplGetDefaultWindow() ); - } - vcl::LazyDeletor::Delete( this ); + Show(false); + SetParent(ImplGetDefaultWindow()); } KeyIndicatorState Window::GetIndicatorState() const diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index a105df5f6e36..45bbfaf7ef9a 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -349,8 +349,8 @@ void Window::EndAutoScroll() pSVData->maWinData.mpAutoScrollWin = nullptr; pSVData->maWinData.mnAutoScrollFlags = StartAutoScrollFlags::NONE; pSVData->maAppData.mpWheelWindow->ImplStop(); - pSVData->maAppData.mpWheelWindow->doLazyDelete(); - pSVData->maAppData.mpWheelWindow = nullptr; + pSVData->maAppData.mpWheelWindow->SetParentToDefaultWindow(); + pSVData->maAppData.mpWheelWindow.disposeAndClear(); } } |