adelmelle
Sun, 11 May 2008 05:22:47 -0700
Author: adelmelle Date: Sun May 11 05:22:22 2008 New Revision: 655309 URL: http://svn.apache.org/viewvc?rev=655309&view=rev Log: Make the LM clean up on end-of-layout, if possible. Added clearChildNodes() method to FObj to release the reference to the FO's children. Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FObj.java xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FObj.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FObj.java?rev=655309&r1=655308&r2=655309&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FObj.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FObj.java Sun May 11 05:22:22 2008 @@ -515,6 +515,13 @@ return -1; } + /** + * Clears the list of child nodes. + */ + public void clearChildNodes() { + this.firstChild = null; + } + /** @return the "id" property. */ public String getId() { return id; @@ -598,7 +605,7 @@ return (super.toString() + "[EMAIL PROTECTED]" + this.id + "]"); } - + /** Basic [EMAIL PROTECTED] FONodeIterator} implementation */ public class FObjIterator implements FONodeIterator { private static final int F_NONE_ALLOWED = 0; Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java?rev=655309&r1=655308&r2=655309&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java Sun May 11 05:22:22 2008 @@ -147,15 +147,11 @@ isFinished = fin; } - /** - * [EMAIL PROTECTED] - */ + /** [EMAIL PROTECTED] */ public void addAreas(PositionIterator posIter, LayoutContext context) { } - /** - * [EMAIL PROTECTED] - */ + /** [EMAIL PROTECTED] */ public LinkedList getNextKnuthElements(LayoutContext context, int alignment) { log.warn("null implementation of getNextKnuthElements() called!"); @@ -163,9 +159,7 @@ return null; } - /** - * [EMAIL PROTECTED] - */ + /** [EMAIL PROTECTED] */ public LinkedList getChangedKnuthElements(List oldList, int alignment) { log.warn("null implementation of getChangeKnuthElement() called!"); @@ -390,7 +384,7 @@ /** * Checks to see if the incoming [EMAIL PROTECTED] Position} * is the last one for this LM, and if so, calls - * [EMAIL PROTECTED] #notifyEndOfLayout()} + * [EMAIL PROTECTED] #notifyEndOfLayout()} and cleans up. * * @param pos the [EMAIL PROTECTED] Position} to check */ @@ -398,7 +392,32 @@ if (pos != null && pos.getLM() == this && this.isLast(pos)) { + notifyEndOfLayout(); + + /* References to the child LMs are no longer needed + */ + childLMs = null; + curChildLM = null; + childLMiter = null; + + /* markers that qualify have been transferred to the page + */ + markers = null; + + /* References to the FO's children can be released if the + * LM is a descendant of the FlowLM. For static-content + * the FO may still be needed on following pages. + */ + LayoutManager lm = this.parentLM; + while (!(lm instanceof FlowLayoutManager + || lm instanceof PageSequenceLayoutManager)) { + lm = lm.getParent(); + } + if (lm instanceof FlowLayoutManager) { + fobj.clearChildNodes(); + fobjIter = null; + } } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]