incubator-ooo-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Bug 120106] There is a memory leak in function SwHTMLWriter::CollectFlyFrms
Date Fri, 29 Jun 2012 16:25:18 GMT

--- Comment #10 from ChaoHuang <> ---
(In reply to comment #7)
> ALG: Comitted extended patch with corrected operator as r.1355342. Thanks
> for the patch and reviewing!
> Keeping opened, please have a look and set it to closed when okay, I'll be
> on vacation the next two weeks.

hi, Armin
I merged the code manually to my local dev env. It works well. The SwPosFlyFrm
obj is created, then being released. There is no such kind of memory leak now.
Thanks for your great work !

I have one question about the extended path in R1355342.
In function "sw::Frames SwPosFlyFrmsToFrames(const SwPosFlyFrms &rFlys)", the
name of iterator in the loop is "aPos", which is the same as the one in "else"
branch. It will make developer confused. Please refer to the code snippet.
  SwPosition aPos((*aPos)->GetNdIndex());

So I suggest to change the iterator name from "aPos" to "aIter". The code may
be like this :

    sw::Frames SwPosFlyFrmsToFrames(const SwPosFlyFrms &rFlys)
        sw::Frames aRet;

        for(SwPosFlyFrms::const_iterator aIter(rFlys.begin()); aIter!=
rFlys.end(); aIter++)
            const SwFrmFmt &rEntry = (*aIter)->GetFmt();

            if (const SwPosition* pAnchor =
                aRet.push_back(sw::Frame(rEntry, *pAnchor));
                SwPosition aPos((*aIter)->GetNdIndex());

                if (SwTxtNode* pTxtNd = aPos.nNode.GetNode().GetTxtNode())
                    aPos.nContent.Assign(pTxtNd, 0);

                aRet.push_back(sw::Frame(rEntry, aPos));
        return aRet;

You are receiving this mail because:
You are the assignee for the bug.

View raw message