summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-06-19 09:21:10 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-06-19 09:22:19 +0100
commit4df6475ffe0d1c1b0acb6b8c02c9da6f388d3387 (patch)
tree0ed58cf0c370453f01d2d87b472a8b0005711333 /sw
parent1e3a00f0c772a76a1dd76b8272e2c35a1802d574 (diff)
ofz: leaks in test harness
Change-Id: I2bcbf84dff8a5f6a2311cd0b1f19e90c03e6175c
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/ww8par.cxx23
1 files changed, 15 insertions, 8 deletions
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;
}