diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2020-06-25 11:24:15 +0200 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2020-07-03 14:48:53 +0200 |
commit | 126c5e57d732359788010d6a364a5011d2e4a8c8 (patch) | |
tree | b0437aa22d9e5ba9e1f35370fc162f85e9c187b0 | |
parent | af2c3124332c02b3ef4065481c1c5b72baf032e8 (diff) |
revert jsdialog: always clean remember widgets
Don't delete all widgets when nested tab page
is used
Change-Id: I0ce2ce976791ca0c8325013df10f01abe341b78d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97119
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97833
Tested-by: Jenkins
-rw-r--r-- | vcl/inc/jsdialog/jsdialogbuilder.hxx | 1 | ||||
-rw-r--r-- | vcl/jsdialog/jsdialogbuilder.cxx | 12 |
2 files changed, 12 insertions, 1 deletions
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index ba4641171a2c..1ef216f18c99 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -53,6 +53,7 @@ class JSInstanceBuilder : public SalInstanceBuilder /// used in case of tab pages where dialog is not a direct top level VclPtr<vcl::Window> m_aParentDialog; bool m_bHasTopLevelDialog; + bool m_bIsNotebookbar; friend VCL_DLLPUBLIC weld::Widget* jsdialog::FindWeldWidgetsMap(sal_uInt64 nWindowId, const OString& rWidget); diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index 767a465c5f3f..8f12489ed44c 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -72,6 +72,7 @@ JSInstanceBuilder::JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIR , m_nWindowId(0) , m_aParentDialog(nullptr) , m_bHasTopLevelDialog(false) + , m_bIsNotebookbar(false) { vcl::Window* pRoot = m_xBuilder->get_widget_root(); if (pRoot && pRoot->GetParent()) @@ -91,6 +92,7 @@ JSInstanceBuilder::JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRo , m_nWindowId(0) , m_aParentDialog(nullptr) , m_bHasTopLevelDialog(false) + , m_bIsNotebookbar(false) { vcl::Window* pRoot = m_xBuilder->get_widget_root(); if (pRoot && pRoot->GetParent()) @@ -99,12 +101,19 @@ JSInstanceBuilder::JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRo if (m_aParentDialog) m_nWindowId = m_aParentDialog->GetLOKWindowId(); if (!m_nWindowId && nWindowId) + { m_nWindowId = nWindowId; + m_bIsNotebookbar = true; + } InsertWindowToMap(m_nWindowId); } } -JSInstanceBuilder::~JSInstanceBuilder() { GetLOKWeldWidgetsMap().erase(m_nWindowId); } +JSInstanceBuilder::~JSInstanceBuilder() +{ + if (m_nWindowId && (m_bHasTopLevelDialog || m_bIsNotebookbar)) + GetLOKWeldWidgetsMap().erase(m_nWindowId); +} std::map<sal_uInt64, WidgetMap>& JSInstanceBuilder::GetLOKWeldWidgetsMap() { @@ -144,6 +153,7 @@ void JSInstanceBuilder::RememberWidget(const OString& id, weld::Widget* pWidget) auto it = GetLOKWeldWidgetsMap().find(m_nWindowId); if (it != GetLOKWeldWidgetsMap().end()) { + it->second.erase(id); it->second.insert(WidgetMap::value_type(id, pWidget)); } } |