[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.0/kdelibs/khtml/rendering
From: Harri Porten <porten () kde ! org>
Date: 2008-03-16 17:23:20
Message-ID: 1205688200.627683.11315.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 786309 by porten:
Merged revision 786289:
Protect anonymous blocks from being deleted while they are actively
insterting a new child
BUG:150006
M +14 -6 render_container.cpp
M +2 -1 render_object.cpp
M +6 -1 render_object.h
--- branches/KDE/4.0/kdelibs/khtml/rendering/render_container.cpp #786308:786309
@@ -55,6 +55,8 @@
kDebug( 6040 ) << this << ": " << renderName() << "(RenderObject)::addChild( " \
<< newChild << ": " <<
newChild->renderName() << ", " << (beforeChild ? beforeChild->renderName() : \
"0") << " )" << endl; #endif
+ // protect ourselves from deletion
+ setDoNotDelete(true);
bool needsTable = false;
@@ -135,6 +137,8 @@
static_cast<RenderText*>(newChild)->setText(textToTransform, true);
}
newChild->attach();
+
+ setDoNotDelete(false);
}
RenderObject* RenderContainer::removeChildNode(RenderObject* oldChild)
@@ -583,7 +587,7 @@
RenderObject *next = child->nextSibling();
if ( child->isRenderBlock() && child->isAnonymousBlock() && !child->continuation() \
&&
- !child->childrenInline() && !child->isTableCell() ) {
+ !child->childrenInline() && !child->isTableCell() && \
!child->doNotDelete()) { RenderObject *firstAnChild = child->firstChild();
RenderObject *lastAnChild = child->lastChild();
if ( firstAnChild ) {
@@ -598,17 +602,21 @@
child->previousSibling()->setNextSibling( firstAnChild );
if ( child->nextSibling() )
child->nextSibling()->setPreviousSibling( lastAnChild );
+ if ( child == firstChild() )
+ m_first = firstAnChild;
+ if ( child == lastChild() )
+ m_last = lastAnChild;
} else {
if ( child->previousSibling() )
child->previousSibling()->setNextSibling( child->nextSibling() );
if ( child->nextSibling() )
child->nextSibling()->setPreviousSibling( child->previousSibling() );
+ if ( child == firstChild() )
+ m_first = child->nextSibling();
+ if ( child == lastChild() )
+ m_last = child->previousSibling();
+ }
- }
- if ( child == firstChild() )
- m_first = firstAnChild;
- if ( child == lastChild() )
- m_last = lastAnChild;
child->setParent( 0 );
child->setPreviousSibling( 0 );
child->setNextSibling( 0 );
--- branches/KDE/4.0/kdelibs/khtml/rendering/render_object.cpp #786308:786309
@@ -184,7 +184,8 @@
m_needsPageClear( false ),
m_containsPageBreak( false ),
m_hasOverflowClip(false),
- m_inPosObjectList(false)
+ m_inPosObjectList(false),
+ m_doNotDelete(false)
{
assert( node );
if (node->getDocument()->documentElement() == node) setIsRoot(true);
--- branches/KDE/4.0/kdelibs/khtml/rendering/render_object.h #786308:786309
@@ -761,6 +761,9 @@
virtual void dirtyInlineBoxes(bool /*fullLayout*/, bool /*isRootLineBox*/ = \
false) {} virtual void dirtyLinesFromChangedChild(RenderObject*) {}
virtual void detach( );
+
+ void setDoNotDelete(bool b) { m_doNotDelete = b; }
+ bool doNotDelete() const { return m_doNotDelete; }
const QFont &font(bool firstLine) const {
return style( firstLine )->font();
@@ -847,9 +850,11 @@
bool m_hasOverflowClip : 1;
bool m_inPosObjectList : 1;
- // ### we have 16 + 26 bits.
+ bool m_doNotDelete : 1; // This object should not be auto-deleted
+ // ### we have 16 + 27 bits.
+
void arenaDelete(RenderArena *arena, void *objectBase);
friend class RenderLayer;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic