From 71fad56863301f47f19fdd47ab93099ad098474e Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 10 Jan 2019 10:44:31 +0000 Subject: Resolves: tdf#122404 unlock just the toplevels that were locked MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit push what toplevels got locked to just unlock those ones. otherwise the just dismissed toplevel may still be present in the Application toplevel list. merge all the similar examples of this. Change-Id: I77c0d55d1e4b3bcc3b8d88fef00ba289edd1e831 Reviewed-on: https://gerrit.libreoffice.org/66080 Tested-by: Jenkins Tested-by: Xisco Faulí Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- vcl/source/window/dialog.cxx | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'vcl/source') diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 285b7c21da15..a1d8cf1e6a6c 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -1532,4 +1533,28 @@ void ModelessDialog::Activate() Dialog::Activate(); } +void TopLevelWindowLocker::incBusy(const vcl::Window* pIgnore) +{ + // lock any toplevel windows from being closed until busy is over + std::vector> aTopLevels; + vcl::Window *pTopWin = Application::GetFirstTopLevelWindow(); + while (pTopWin) + { + if (pTopWin != pIgnore) + aTopLevels.push_back(pTopWin); + pTopWin = Application::GetNextTopLevelWindow(pTopWin); + } + for (auto& a : aTopLevels) + a->IncModalCount(); + m_aBusyStack.push(aTopLevels); +} + +void TopLevelWindowLocker::decBusy() +{ + // unlock locked toplevel windows from being closed now busy is over + for (auto& a : m_aBusyStack.top()) + a->DecModalCount(); + m_aBusyStack.pop(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit