[Libreoffice-commits] core.git: filter/source
Caolán McNamara
caolanm at redhat.com
Wed May 17 12:32:57 UTC 2017
filter/source/xsltdialog/xmlfiltersettingsdialog.cxx | 28 ++++++++++++++-----
filter/source/xsltdialog/xmlfiltersettingsdialog.hxx | 11 ++++++-
2 files changed, 31 insertions(+), 8 deletions(-)
New commits:
commit f7efddff6621e0c6f967f7159cf929a108285c34
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed May 17 11:34:55 2017 +0100
don't create a new ResMgr for each string
since...
commit f3f71b087d25966d39a4c883bbe0b60b27419119
Date: Fri Nov 11 18:25:37 2016 +0100
Avoid -fsanitize=null
...during CppunitTest_filter_dialogs_test:
Change-Id: I9c267816d013c27922621b6c8a75c53ce5b78bd8
Reviewed-on: https://gerrit.libreoffice.org/37704
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
index 490f3ad60f27..6bcd6f24fc7e 100644
--- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
@@ -61,16 +61,30 @@ using namespace com::sun::star::util;
using ::rtl::Uri;
namespace {
+ static ResMgr* pXSLTResMgr = nullptr;
-std::unique_ptr<ResMgr> getXSLTDialogResMgr() {
- return std::unique_ptr<ResMgr>(
- ResMgr::CreateResMgr(
- "xsltdlg", Application::GetSettings().GetUILanguageTag()));
+ ResMgr* getXSLTDialogResMgr()
+ {
+ return pXSLTResMgr;
+ }
+}
+
+EnsureResMgr::EnsureResMgr()
+{
+ if (!pXSLTResMgr)
+ {
+ m_xResMgr.reset(ResMgr::CreateResMgr("xsltdlg", Application::GetSettings().GetUILanguageTag()));
+ pXSLTResMgr = m_xResMgr.get();
+ }
}
+EnsureResMgr::~EnsureResMgr()
+{
+ if (m_xResMgr)
+ pXSLTResMgr = nullptr;
}
-#define RESID(x) ResId(x, *getXSLTDialogResMgr().get())
+#define RESID(x) ResId(x, *getXSLTDialogResMgr())
#define RESIDSTR(x) RESID(x).toString()
XMLFilterSettingsDialog::XMLFilterSettingsDialog(vcl::Window* pParent,
@@ -246,7 +260,7 @@ void XMLFilterSettingsDialog::onNew()
aTempInfo.maDocumentService = "com.sun.star.text.TextDocument";
// execute XML Filter Dialog
- ScopedVclPtrInstance< XMLFilterTabDialog > aDlg( this, *getXSLTDialogResMgr().get(), mxContext, &aTempInfo );
+ ScopedVclPtrInstance< XMLFilterTabDialog > aDlg( this, *getXSLTDialogResMgr(), mxContext, &aTempInfo );
if ( aDlg->Execute() == RET_OK )
{
// insert the new filter
@@ -265,7 +279,7 @@ void XMLFilterSettingsDialog::onEdit()
filter_info_impl* pOldInfo = static_cast<filter_info_impl*>(pEntry->GetUserData());
// execute XML Filter Dialog
- ScopedVclPtrInstance< XMLFilterTabDialog > aDlg( this, *getXSLTDialogResMgr().get(), mxContext, pOldInfo );
+ ScopedVclPtrInstance< XMLFilterTabDialog > aDlg( this, *getXSLTDialogResMgr(), mxContext, pOldInfo );
if ( aDlg->Execute() == RET_OK )
{
filter_info_impl* pNewInfo = aDlg->getNewFilterInfo();
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx
index 24617d0261fd..5105c67936c2 100644
--- a/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx
@@ -55,11 +55,20 @@ public:
virtual bool EventNotify( NotifyEvent& rNEvt ) override;
};
+class EnsureResMgr
+{
+ std::unique_ptr<ResMgr> m_xResMgr;
+public:
+ EnsureResMgr();
+ ~EnsureResMgr();
+};
+
class HeaderBar;
class XMLFilterListBox : public SvTabListBox
{
private:
+ EnsureResMgr m_aEnsureResMgr;
VclPtr<HeaderBar> m_pHeaderBar;
DECL_LINK( TabBoxScrollHdl_Impl, SvTreeListBox*, void );
@@ -118,7 +127,7 @@ private:
OUString createUniqueInterfaceName( const OUString& rInterfaceName );
private:
-
+ EnsureResMgr maEnsureResMgr;
css::uno::Reference< css::uno::XComponentContext > mxContext;
css::uno::Reference< css::container::XNameContainer > mxFilterContainer;
css::uno::Reference< css::container::XNameContainer > mxTypeDetection;
More information about the Libreoffice-commits
mailing list