include/vcl/window.hxx | 3 +++ vcl/source/app/svmain.cxx | 3 +++ vcl/source/window/floatwin.cxx | 2 ++ vcl/source/window/window.cxx | 8 +++++--- 4 files changed, 13 insertions(+), 3 deletions(-)
New commits: commit 3bf5610d14a6dd5f093314016ba25038fe06fdf1 Author: Henry Castro <hcas...@collabora.com> AuthorDate: Mon Dec 9 18:49:37 2019 -0400 Commit: Henry Castro <hcas...@collabora.com> CommitDate: Wed Dec 11 03:25:39 2019 +0100 lok: evaluate assertion if LOK Windows container is empty It has defined a map container for every LOK windows assigned a notifier to the client side. However the map container has elements with VclPtr (reference counter) and it is a global data, so when global data are disposing, the VclPtr will destroy the Window when the VCL framework was destroyed that will lead to undefined behavior. So this commit adds an assert inside DeInitVCL to ensure, if someone forgot to Release the LOK Notifier. Change-Id: Ib7f20751af2931f7b0ba3e3d526e734ffc33f171 Reviewed-on: https://gerrit.libreoffice.org/84792 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Jan Holesovsky <ke...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/84909 Tested-by: Jenkins Reviewed-by: Henry Castro <hcas...@collabora.com> diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index c0381b8c75c9..f090fef97203 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -1205,6 +1205,9 @@ public: /// Find an existing Window based on the LOKWindowId. static VclPtr<vcl::Window> FindLOKWindow(vcl::LOKWindowId nWindowId); + /// check if LOK Window container is empty + static bool IsLOKWindowsEmpty(); + /// Dumps itself and potentially its children to a property tree, to be written easily to JSON. virtual boost::property_tree::ptree DumpAsPropertyTree(); diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index cd6f3b781823..333aa19e6ea8 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -408,6 +408,9 @@ VCLUnoWrapperDeleter::disposing(lang::EventObject const& /* rSource */) void DeInitVCL() { + // The LOK Windows map container should be empty + assert(vcl::Window::IsLOKWindowsEmpty()); + //rhbz#1444437, when using LibreOffice like a library you can't realistically //tear everything down and recreate them on the next call, there's too many //(c++) singletons that point to stuff that gets deleted during shutdown diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index 672eb6236fee..e3abe5dcd169 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -202,6 +202,8 @@ FloatingWindow::~FloatingWindow() void FloatingWindow::dispose() { + ReleaseLOKNotifier(); + if (mpImplData) { if( mbPopupModeCanceled ) diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 19e2e105a168..b1f0762f01e7 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -3162,9 +3162,6 @@ namespace { LOKWindowsMap& GetLOKWindowsMap() { - // never use this in the desktop case - assert(comphelper::LibreOfficeKit::isActive()); - // Map to remember the LOKWindowId <-> Window binding. static LOKWindowsMap s_aLOKWindowsMap; @@ -3206,6 +3203,11 @@ VclPtr<Window> Window::FindLOKWindow(vcl::LOKWindowId nWindowId) return VclPtr<Window>(); } +bool Window::IsLOKWindowsEmpty() +{ + return GetLOKWindowsMap().empty(); +} + void Window::ReleaseLOKNotifier() { // unregister the LOK window binding _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits