Kaydet (Commit) 867bf5b4 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

fix memory leak in change tracking export

Change-Id: Idffa7c4a9c9519c150458db3749e7b67fbbb463c
üst a0ac896f
...@@ -251,7 +251,7 @@ class XclExpXmlChTrHeader : public ExcXmlRecord ...@@ -251,7 +251,7 @@ class XclExpXmlChTrHeader : public ExcXmlRecord
sal_uInt32 mnMaxAction; sal_uInt32 mnMaxAction;
std::vector<sal_uInt16> maTabBuffer; std::vector<sal_uInt16> maTabBuffer;
std::vector<XclExpChTrAction*> maActions; std::vector<std::unique_ptr<XclExpChTrAction>> maActions;
public: public:
XclExpXmlChTrHeader( XclExpXmlChTrHeader(
...@@ -260,7 +260,7 @@ public: ...@@ -260,7 +260,7 @@ public:
virtual void SaveXml( XclExpXmlStream& rStrm ) override; virtual void SaveXml( XclExpXmlStream& rStrm ) override;
void AppendAction( XclExpChTrAction* pAction ); void AppendAction( std::unique_ptr<XclExpChTrAction> pAction );
}; };
// XclExpChTrInfo - header of action group of a user // XclExpChTrInfo - header of action group of a user
......
...@@ -476,11 +476,10 @@ void XclExpXmlChTrHeader::SaveXml( XclExpXmlStream& rStrm ) ...@@ -476,11 +476,10 @@ void XclExpXmlChTrHeader::SaveXml( XclExpXmlStream& rStrm )
pRevLogStrm->write(">"); pRevLogStrm->write(">");
std::vector<XclExpChTrAction*>::iterator it = maActions.begin(), itEnd = maActions.end(); auto it = maActions.begin(), itEnd = maActions.end();
for (; it != itEnd; ++it) for (; it != itEnd; ++it)
{ {
XclExpChTrAction* p = *it; (*it)->SaveXml(rStrm);
p->SaveXml(rStrm);
} }
pRevLogStrm->write("</")->writeId(XML_revisions)->write(">"); pRevLogStrm->write("</")->writeId(XML_revisions)->write(">");
...@@ -490,7 +489,7 @@ void XclExpXmlChTrHeader::SaveXml( XclExpXmlStream& rStrm ) ...@@ -490,7 +489,7 @@ void XclExpXmlChTrHeader::SaveXml( XclExpXmlStream& rStrm )
pHeader->write("</")->writeId(XML_header)->write(">"); pHeader->write("</")->writeId(XML_header)->write(">");
} }
void XclExpXmlChTrHeader::AppendAction( XclExpChTrAction* pAction ) void XclExpXmlChTrHeader::AppendAction( std::unique_ptr<XclExpChTrAction> pAction )
{ {
sal_uInt32 nActionNum = pAction->GetActionNumber(); sal_uInt32 nActionNum = pAction->GetActionNumber();
if (!mnMinAction || mnMinAction > nActionNum) if (!mnMinAction || mnMinAction > nActionNum)
...@@ -499,7 +498,7 @@ void XclExpXmlChTrHeader::AppendAction( XclExpChTrAction* pAction ) ...@@ -499,7 +498,7 @@ void XclExpXmlChTrHeader::AppendAction( XclExpChTrAction* pAction )
if (!mnMaxAction || mnMaxAction < nActionNum) if (!mnMaxAction || mnMaxAction < nActionNum)
mnMaxAction = nActionNum; mnMaxAction = nActionNum;
maActions.push_back(pAction); maActions.push_back(std::move(pAction));
} }
XclExpChTrInfo::XclExpChTrInfo( const OUString& rUsername, const DateTime& rDateTime, const sal_uInt8* pGUID ) : XclExpChTrInfo::XclExpChTrInfo( const OUString& rUsername, const DateTime& rDateTime, const sal_uInt8* pGUID ) :
...@@ -1517,7 +1516,7 @@ XclExpChangeTrack::XclExpChangeTrack( const XclExpRoot& rRoot ) : ...@@ -1517,7 +1516,7 @@ XclExpChangeTrack::XclExpChangeTrack( const XclExpRoot& rRoot ) :
pHeaders->SetGUID(aGUID); pHeaders->SetGUID(aGUID);
} }
pAction->SetIndex(nIndex); pAction->SetIndex(nIndex);
pCurHeader->AppendAction(pAction); pCurHeader->AppendAction(std::unique_ptr<XclExpChTrAction>(pAction));
} }
pHeaders->SetGUID(aGUID); pHeaders->SetGUID(aGUID);
......
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