Kaydet (Commit) 4df6475f authored tarafından Caolán McNamara's avatar Caolán McNamara

ofz: leaks in test harness

Change-Id: I2bcbf84dff8a5f6a2311cd0b1f19e90c03e6175c
üst 1e3a00f0
...@@ -6170,12 +6170,22 @@ extern "C" SAL_DLLPUBLIC_EXPORT Reader* SAL_CALL ImportDOC() ...@@ -6170,12 +6170,22 @@ extern "C" SAL_DLLPUBLIC_EXPORT Reader* SAL_CALL ImportDOC()
return new WW8Reader; return new WW8Reader;
} }
class FontCacheGuard
{
public:
~FontCacheGuard()
{
FlushFontCache();
}
};
bool SAL_CALL TestImportDOC(SvStream &rStream, const OUString &rFltName) bool SAL_CALL TestImportDOC(SvStream &rStream, const OUString &rFltName)
{ {
Reader *pReader = ImportDOC(); FontCacheGuard aFontCacheGuard;
std::unique_ptr<Reader> xReader(ImportDOC());
tools::SvRef<SotStorage> xStorage; tools::SvRef<SotStorage> xStorage;
pReader->pStrm = &rStream; xReader->pStrm = &rStream;
if (rFltName != "WW6") if (rFltName != "WW6")
{ {
try try
...@@ -6188,9 +6198,9 @@ bool SAL_CALL TestImportDOC(SvStream &rStream, const OUString &rFltName) ...@@ -6188,9 +6198,9 @@ bool SAL_CALL TestImportDOC(SvStream &rStream, const OUString &rFltName)
{ {
return false; return false;
} }
pReader->pStg = xStorage.get(); xReader->pStg = xStorage.get();
} }
pReader->SetFltName(rFltName); xReader->SetFltName(rFltName);
SwGlobals::ensure(); SwGlobals::ensure();
...@@ -6207,11 +6217,8 @@ bool SAL_CALL TestImportDOC(SvStream &rStream, const OUString &rFltName) ...@@ -6207,11 +6217,8 @@ bool SAL_CALL TestImportDOC(SvStream &rStream, const OUString &rFltName)
SwPaM aPaM( aIdx ); SwPaM aPaM( aIdx );
aPaM.GetPoint()->nContent.Assign(aIdx.GetNode().GetContentNode(), 0); aPaM.GetPoint()->nContent.Assign(aIdx.GetNode().GetContentNode(), 0);
pD->SetInReading(true); pD->SetInReading(true);
bool bRet = pReader->Read(*pD, OUString(), aPaM, OUString()) == 0; bool bRet = xReader->Read(*pD, OUString(), aPaM, OUString()) == 0;
pD->SetInReading(false); pD->SetInReading(false);
delete pReader;
FlushFontCache();
return bRet; return bRet;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment