[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:16:43 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 2b5e6e2ce5ab145ee688be2178dfa9e757bc9636
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Dec 20 19:21:24 2002 +0000

            Reviewed by Richard and John.
    
    	- fixed 3133207 -- crash in HTMLFrameElementImpl updateForNewURL at home.real.com
    
    	This refines Maciej's fix for 3052113, 3075392, and 3125412.
    
            * khtml/html/html_baseimpl.h: Remove detach() and parentWidget from HTMLFrameElementImpl.
            * khtml/html/html_baseimpl.cpp:
            (HTMLFrameElementImpl::HTMLFrameElementImpl): Take out initialization of unused parentWidget.
            (HTMLFrameElementImpl::updateForNewURL): Add case for when we are attached by did not allocate
    	a render object. In that case we just detach so we can attach again. Also fix the self-reference
    	check which was in there but not working.
            (HTMLFrameElementImpl::detach): Remove method since all it did was set unused parentWidget.
            (HTMLIFrameElementImpl::attach): Remove unused depth computation.
    
    	- fixed more leaks
    
            * khtml/rendering/render_replaced.h: Made the deref method inherited from khtml::Shared
    	private by using private inheritance. Changed the name of arenaDeref to deref, but it still
    	takes an arena parameter. Now incorrect deref's are compile-time errors instead of potential leaks.
            * khtml/rendering/render_replaced.cpp:
            (RenderWidget::detach): Rename arenaDeref to deref.
            (RenderWidget::resizeWidget): Ditto.
            (RenderWidget::eventFilter): Ditto.
            (RenderWidget::deref): Ditto.
    
            * khtml/rendering/render_form.cpp: (RenderFormElement::slotClicked):
    	Pass the arena when deref'ing the RenderFormElement.
            * kwq/WebCoreBridge.h: Add a field for the arena for the RenderPart.
            * kwq/WebCoreBridge.mm:
            (-[WebCoreBridge dealloc]): Pass the arena when deref'ing the RenderPart.
            (-[WebCoreBridge setRenderPart:]): Pass the arena when deref'ing the RenderPart. Store the arena
    	of the new part when storing the part pointer.
    
            * khtml/xml/dom_docimpl.cpp: (DocumentImpl::~DocumentImpl): Assert that the render object is
    	not nil, in an attempt to catch a leak I observed yesterday.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3148 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index bc39ee1..aea4c1c 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,5 +1,44 @@
 2002-12-20  Darin Adler  <darin at apple.com>
 
+        Reviewed by Richard and John.
+
+	- fixed 3133207 -- crash in HTMLFrameElementImpl updateForNewURL at home.real.com
+
+	This refines Maciej's fix for 3052113, 3075392, and 3125412.
+
+        * khtml/html/html_baseimpl.h: Remove detach() and parentWidget from HTMLFrameElementImpl.
+        * khtml/html/html_baseimpl.cpp:
+        (HTMLFrameElementImpl::HTMLFrameElementImpl): Take out initialization of unused parentWidget.
+        (HTMLFrameElementImpl::updateForNewURL): Add case for when we are attached by did not allocate
+	a render object. In that case we just detach so we can attach again. Also fix the self-reference
+	check which was in there but not working.
+        (HTMLFrameElementImpl::detach): Remove method since all it did was set unused parentWidget. 
+        (HTMLIFrameElementImpl::attach): Remove unused depth computation.
+
+	- fixed more leaks
+
+        * khtml/rendering/render_replaced.h: Made the deref method inherited from khtml::Shared
+	private by using private inheritance. Changed the name of arenaDeref to deref, but it still
+	takes an arena parameter. Now incorrect deref's are compile-time errors instead of potential leaks.
+        * khtml/rendering/render_replaced.cpp:
+        (RenderWidget::detach): Rename arenaDeref to deref.
+        (RenderWidget::resizeWidget): Ditto.
+        (RenderWidget::eventFilter): Ditto.
+        (RenderWidget::deref): Ditto.
+
+        * khtml/rendering/render_form.cpp: (RenderFormElement::slotClicked):
+	Pass the arena when deref'ing the RenderFormElement.
+        * kwq/WebCoreBridge.h: Add a field for the arena for the RenderPart.
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge dealloc]): Pass the arena when deref'ing the RenderPart.
+        (-[WebCoreBridge setRenderPart:]): Pass the arena when deref'ing the RenderPart. Store the arena
+	of the new part when storing the part pointer.
+
+        * khtml/xml/dom_docimpl.cpp: (DocumentImpl::~DocumentImpl): Assert that the render object is
+	not nil, in an attempt to catch a leak I observed yesterday.
+
+2002-12-20  Darin Adler  <darin at apple.com>
+
         Reviewed by Dave.
 
 	- fixed 3129129 -- leak of 820 RenderStyle objects each time we run cvs-base
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index bc39ee1..aea4c1c 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,44 @@
 2002-12-20  Darin Adler  <darin at apple.com>
 
+        Reviewed by Richard and John.
+
+	- fixed 3133207 -- crash in HTMLFrameElementImpl updateForNewURL at home.real.com
+
+	This refines Maciej's fix for 3052113, 3075392, and 3125412.
+
+        * khtml/html/html_baseimpl.h: Remove detach() and parentWidget from HTMLFrameElementImpl.
+        * khtml/html/html_baseimpl.cpp:
+        (HTMLFrameElementImpl::HTMLFrameElementImpl): Take out initialization of unused parentWidget.
+        (HTMLFrameElementImpl::updateForNewURL): Add case for when we are attached by did not allocate
+	a render object. In that case we just detach so we can attach again. Also fix the self-reference
+	check which was in there but not working.
+        (HTMLFrameElementImpl::detach): Remove method since all it did was set unused parentWidget. 
+        (HTMLIFrameElementImpl::attach): Remove unused depth computation.
+
+	- fixed more leaks
+
+        * khtml/rendering/render_replaced.h: Made the deref method inherited from khtml::Shared
+	private by using private inheritance. Changed the name of arenaDeref to deref, but it still
+	takes an arena parameter. Now incorrect deref's are compile-time errors instead of potential leaks.
+        * khtml/rendering/render_replaced.cpp:
+        (RenderWidget::detach): Rename arenaDeref to deref.
+        (RenderWidget::resizeWidget): Ditto.
+        (RenderWidget::eventFilter): Ditto.
+        (RenderWidget::deref): Ditto.
+
+        * khtml/rendering/render_form.cpp: (RenderFormElement::slotClicked):
+	Pass the arena when deref'ing the RenderFormElement.
+        * kwq/WebCoreBridge.h: Add a field for the arena for the RenderPart.
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge dealloc]): Pass the arena when deref'ing the RenderPart.
+        (-[WebCoreBridge setRenderPart:]): Pass the arena when deref'ing the RenderPart. Store the arena
+	of the new part when storing the part pointer.
+
+        * khtml/xml/dom_docimpl.cpp: (DocumentImpl::~DocumentImpl): Assert that the render object is
+	not nil, in an attempt to catch a leak I observed yesterday.
+
+2002-12-20  Darin Adler  <darin at apple.com>
+
         Reviewed by Dave.
 
 	- fixed 3129129 -- leak of 820 RenderStyle objects each time we run cvs-base
diff --git a/WebCore/khtml/html/html_baseimpl.cpp b/WebCore/khtml/html/html_baseimpl.cpp
index 95c934c..0ad6ed5 100644
--- a/WebCore/khtml/html/html_baseimpl.cpp
+++ b/WebCore/khtml/html/html_baseimpl.cpp
@@ -208,8 +208,6 @@ void HTMLBodyElementImpl::attach()
 HTMLFrameElementImpl::HTMLFrameElementImpl(DocumentPtr *doc)
     : HTMLElementImpl(doc)
 {
-    parentWidget = 0;
-
     frameBorder = true;
     frameBorderSet = false;
     marginWidth = -1;
@@ -231,7 +229,16 @@ NodeImpl::Id HTMLFrameElementImpl::id() const
 void HTMLFrameElementImpl::updateForNewURL()
 {
     if (attached()) {
-	// ignore display: none for this element!
+        // Handle the common case where we decided not to make a frame the first time.
+        // Detach and the let attach() decide again whether to make the frame for this URL.
+        if (!m_render) {
+            detach();
+            attach();
+            return;
+        }
+
+        // The following is repeated logic from attach(). We should share the code instead.
+        
 	KHTMLView* w = getDocument()->view();
 	// avoid endless recursion
 	KURL u;
@@ -242,6 +249,8 @@ void HTMLFrameElementImpl::updateForNewURL()
 		selfreference = true;
 		break;
 	    }
+        if (selfreference)
+            return;
 
 	// load the frame contents
 	if ( !url.isEmpty() && !(w->part()->onlyLocalReferences() && u.protocol() != "file")) {
@@ -258,7 +267,7 @@ void HTMLFrameElementImpl::parseAttribute(AttributeImpl *attr)
     {
     case ATTR_SRC:
         url = khtml::parseURL(attr->val());
-	updateForNewURL();
+        updateForNewURL();
         break;
     case ATTR_ID:
     case ATTR_NAME:
@@ -355,12 +364,6 @@ void HTMLFrameElementImpl::attach()
         w->part()->requestFrame( static_cast<RenderFrame*>(m_render), url.string(), name.string() );
 }
 
-void HTMLFrameElementImpl::detach()
-{
-    HTMLElementImpl::detach();
-    parentWidget = 0;
-}
-
 void HTMLFrameElementImpl::setLocation( const DOMString& str )
 {
     url = str;
@@ -645,11 +648,6 @@ void HTMLIFrameElementImpl::attach()
             break;
         }
 
-    KHTMLPart *part = w->part();
-    int depth = 0;
-    while ((part = part->parentPart()))
-	depth++;
-
     RenderStyle* _style = getDocument()->styleSelector()->styleForElement(this);
     _style->ref();
     if (!selfreference && !(w->part()->onlyLocalReferences() && u.protocol() != "file") &&
diff --git a/WebCore/khtml/html/html_baseimpl.h b/WebCore/khtml/html/html_baseimpl.h
index 5125b53..75a7aff 100644
--- a/WebCore/khtml/html/html_baseimpl.h
+++ b/WebCore/khtml/html/html_baseimpl.h
@@ -85,7 +85,6 @@ public:
     virtual void parseAttribute(AttributeImpl *);
     virtual void init();
     virtual void attach();
-    virtual void detach();
 
     bool noResize() { return noresize; }
     void setLocation( const DOMString& str );
@@ -104,7 +103,6 @@ public:
 protected:
     DOMString url;
     DOMString name;
-    KHTMLView *parentWidget;
 
     int marginWidth;
     int marginHeight;
diff --git a/WebCore/khtml/rendering/render_form.cpp b/WebCore/khtml/rendering/render_form.cpp
index 9ecb501..70423a0 100644
--- a/WebCore/khtml/rendering/render_form.cpp
+++ b/WebCore/khtml/rendering/render_form.cpp
@@ -183,12 +183,12 @@ void RenderFormElement::layout()
 
 void RenderFormElement::slotClicked()
 {
-    ref();
+    RenderArena *arena = ref();
     QMouseEvent e2( QEvent::MouseButtonRelease, m_mousePos, m_button, m_state);
 
     element()->dispatchMouseEvent(&e2, m_isDoubleClick ? EventImpl::KHTML_DBLCLICK_EVENT : EventImpl::KHTML_CLICK_EVENT, m_clickCount);
     m_isDoubleClick = false;
-    deref();
+    deref(arena);
 }
 
 // -------------------------------------------------------------------------
diff --git a/WebCore/khtml/rendering/render_replaced.cpp b/WebCore/khtml/rendering/render_replaced.cpp
index 80a8f29..13cb862 100644
--- a/WebCore/khtml/rendering/render_replaced.cpp
+++ b/WebCore/khtml/rendering/render_replaced.cpp
@@ -145,7 +145,7 @@ void RenderWidget::detach(RenderArena* renderArena)
         m_widget->setMouseTracking( false );
     }
     
-    arenaDeref(renderArena);
+    deref(renderArena);
 }
 
 RenderWidget::~RenderWidget()
@@ -164,12 +164,11 @@ void  RenderWidget::resizeWidget( QWidget *widget, int w, int h )
 #endif
 
     if (widget->width() != w || widget->height() != h) {
-        RenderArena *arena = renderArena();
-        ref();
+        RenderArena *arena = ref();
         element()->ref();
         widget->resize( w, h );
         element()->deref();
-        arenaDeref(arena);
+        deref(arena);
     }
 }
 
@@ -300,8 +299,7 @@ bool RenderWidget::eventFilter(QObject* /*o*/, QEvent* e)
 {
     if ( !element() ) return true;
 
-    RenderArena *arena = renderArena();
-    ref();
+    RenderArena *arena = ref();
     element()->ref();
 
     bool filtered = false;
@@ -396,12 +394,12 @@ bool RenderWidget::eventFilter(QObject* /*o*/, QEvent* e)
     // stop processing if the widget gets deleted, but continue in all other cases
     if (hasOneRef())
         filtered = true;
-    arenaDeref(arena);
+    deref(arena);
 
     return filtered;
 }
 
-void RenderWidget::arenaDeref(RenderArena *arena)
+void RenderWidget::deref(RenderArena *arena)
 {
     if (_ref) _ref--; 
     if (!_ref)
diff --git a/WebCore/khtml/rendering/render_replaced.h b/WebCore/khtml/rendering/render_replaced.h
index 5083177..51c85ed 100644
--- a/WebCore/khtml/rendering/render_replaced.h
+++ b/WebCore/khtml/rendering/render_replaced.h
@@ -62,7 +62,7 @@ private:
 };
 
 
-class RenderWidget : public QObject, public RenderReplaced, public khtml::Shared<RenderWidget>
+class RenderWidget : public QObject, public RenderReplaced, private khtml::Shared<RenderWidget>
 {
     Q_OBJECT
 public:
@@ -82,7 +82,8 @@ public:
     QWidget *widget() const { return m_widget; }
     KHTMLView* view() const { return m_view; }
 
-    void arenaDeref(RenderArena *arena);
+    RenderArena *ref() { _ref++; return renderArena(); }
+    void deref(RenderArena *arena);
 
 public slots:
     void slotWidgetDestructed();
@@ -94,9 +95,6 @@ protected:
 
     QWidget *m_widget;
     KHTMLView* m_view;
-
-private:
-    using khtml::Shared<RenderWidget>::deref;
 };
 
 };
diff --git a/WebCore/khtml/xml/dom_docimpl.cpp b/WebCore/khtml/xml/dom_docimpl.cpp
index 1828c75..d105f46 100644
--- a/WebCore/khtml/xml/dom_docimpl.cpp
+++ b/WebCore/khtml/xml/dom_docimpl.cpp
@@ -296,6 +296,8 @@ DocumentImpl::DocumentImpl(DOMImplementationImpl *_implementation, KHTMLView *v)
 
 DocumentImpl::~DocumentImpl()
 {
+    assert(!m_render);
+    
     KJS::ScriptInterpreter::forgetDOMObjectsForDocument(this);
 
     if (changedDocuments && m_docChanged)
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index f7a1105..2353139 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -29,6 +29,7 @@
 
 class KWQKHTMLPart;
 class KHTMLView;
+class RenderArena;
 
 namespace khtml {
     class RenderPart;
@@ -42,6 +43,7 @@ typedef khtml::RenderPart KHTMLRenderPart;
 @class KWQKHTMLPart;
 @class KHTMLView;
 @class KHTMLRenderPart;
+ at class RenderArena;
 
 #endif
 
@@ -85,6 +87,7 @@ enum FrameBorderStyle {
 {
     KWQKHTMLPart *_part;
     KHTMLRenderPart *_renderPart;
+    RenderArena *_renderPartArena;
 }
 
 - (void)setRenderPart:(KHTMLRenderPart *)renderPart;
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index c004564..226287f 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -105,7 +105,7 @@ static bool initializedObjectCacheSize = FALSE;
     [self removeFromFrame];
     
     if (_renderPart) {
-        _renderPart->deref();
+        _renderPart->deref(_renderPartArena);
     }
     _part->setBridge(nil);
     _part->deref();
@@ -120,11 +120,12 @@ static bool initializedObjectCacheSize = FALSE;
 
 - (void)setRenderPart:(KHTMLRenderPart *)newPart;
 {
-    newPart->ref();
+    RenderArena *arena = newPart->ref();
     if (_renderPart) {
-        _renderPart->deref();
+        _renderPart->deref(_renderPartArena);
     }
     _renderPart = newPart;
+    _renderPartArena = arena;
 }
 
 - (KHTMLRenderPart *)renderPart

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list