summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2019-12-09 18:49:37 -0400
committerJan Holesovsky <kendy@collabora.com>2019-12-10 13:12:41 +0100
commit4a437520d6295327d42a586e908c4c6e7b24561e (patch)
treed26005c86fe58822dad92fa14a781744444185d4 /vcl
parent5ddad0c80efa15500e3259839e2eebcba2e8e241 (diff)
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 <jenkinscollaboraoffice@gmail.com> Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/app/svmain.cxx3
-rw-r--r--vcl/source/window/floatwin.cxx2
-rw-r--r--vcl/source/window/window.cxx8
3 files changed, 10 insertions, 3 deletions
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index f3bcac658e1a..3fd6d86b1bc0 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -416,6 +416,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 72dff4985c34..8257aeea7d7d 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 20187261ee22..6d5a73fc8f62 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3178,9 +3178,6 @@ namespace {
LOKWindowsMap& GetLOKWindowsMap()
{
- // never use this in the desktop case
- assert(comphelper::LibreOfficeKit::isActive());
-
// Map to remember the LOKWindowId <-> Window binding.
static std::unique_ptr<LOKWindowsMap> s_pLOKWindowsMap;
@@ -3225,6 +3222,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