vcl/inc/jsdialog/jsdialogbuilder.hxx | 1 + vcl/jsdialog/jsdialogbuilder.cxx | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-)
New commits: commit 880b1566956b2ca1e8b80a278458bd8884039096 Author: Szymon Kłos <[email protected]> AuthorDate: Thu Jun 25 11:24:15 2020 +0200 Commit: Szymon Kłos <[email protected]> CommitDate: Fri Jun 26 10:11:11 2020 +0200 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 <[email protected]> Reviewed-by: Szymon Kłos <[email protected]> diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index c67b58d31331..362344b6a8b0 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -55,6 +55,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 f4a1b17cf221..73cb41e0e089 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -64,6 +64,7 @@ JSInstanceBuilder::JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIR , m_nWindowId(0) , m_aParentDialog(nullptr) , m_bHasTopLevelDialog(false) + , m_bIsNotebookbar(false) { vcl::Window* pRoot = get_builder().get_widget_root(); if (pRoot && pRoot->GetParent()) @@ -83,6 +84,7 @@ JSInstanceBuilder::JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRo , m_nWindowId(0) , m_aParentDialog(nullptr) , m_bHasTopLevelDialog(false) + , m_bIsNotebookbar(false) { vcl::Window* pRoot = get_builder().get_widget_root(); if (pRoot && pRoot->GetParent()) @@ -91,12 +93,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() { @@ -136,6 +145,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)); } } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
