[Libreoffice-commits] core.git: sw/source
Caolán McNamara
caolanm at redhat.com
Mon Jun 19 08:22:52 UTC 2017
sw/source/filter/ww8/ww8par.cxx | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
New commits:
commit 4df6475ffe0d1c1b0acb6b8c02c9da6f388d3387
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Jun 19 09:21:10 2017 +0100
ofz: leaks in test harness
Change-Id: I2bcbf84dff8a5f6a2311cd0b1f19e90c03e6175c
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 1ce758822888..30cf48d92935 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -6170,12 +6170,22 @@ extern "C" SAL_DLLPUBLIC_EXPORT Reader* SAL_CALL ImportDOC()
return new WW8Reader;
}
+class FontCacheGuard
+{
+public:
+ ~FontCacheGuard()
+ {
+ FlushFontCache();
+ }
+};
+
bool SAL_CALL TestImportDOC(SvStream &rStream, const OUString &rFltName)
{
- Reader *pReader = ImportDOC();
+ FontCacheGuard aFontCacheGuard;
+ std::unique_ptr<Reader> xReader(ImportDOC());
tools::SvRef<SotStorage> xStorage;
- pReader->pStrm = &rStream;
+ xReader->pStrm = &rStream;
if (rFltName != "WW6")
{
try
@@ -6188,9 +6198,9 @@ bool SAL_CALL TestImportDOC(SvStream &rStream, const OUString &rFltName)
{
return false;
}
- pReader->pStg = xStorage.get();
+ xReader->pStg = xStorage.get();
}
- pReader->SetFltName(rFltName);
+ xReader->SetFltName(rFltName);
SwGlobals::ensure();
@@ -6207,11 +6217,8 @@ bool SAL_CALL TestImportDOC(SvStream &rStream, const OUString &rFltName)
SwPaM aPaM( aIdx );
aPaM.GetPoint()->nContent.Assign(aIdx.GetNode().GetContentNode(), 0);
pD->SetInReading(true);
- bool bRet = pReader->Read(*pD, OUString(), aPaM, OUString()) == 0;
+ bool bRet = xReader->Read(*pD, OUString(), aPaM, OUString()) == 0;
pD->SetInReading(false);
- delete pReader;
-
- FlushFontCache();
return bRet;
}
More information about the Libreoffice-commits
mailing list