[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 08:20:33 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit d012132039b8e027f5de682722833dc74c7af941
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Dec 23 23:52:15 2003 +0000

            Reviewed by John.
    
            - another try at fixing the -[KWQPageState dealloc] bug, even though we don't fully understand it
    
            This change saves the renderer inside the document rather than in the KWQPageState to
            try to eliminate the possibility that multiple KWQPageState objects could restore the
            same renderer multiple times, resulting in multiple detaches of the same renderer.
    
            * khtml/xml/dom_docimpl.h: Add a m_savedRenderer field.
            * khtml/xml/dom_docimpl.cpp:
            (DocumentImpl::DocumentImpl): Initialize m_savedRenderer to 0.
            (DocumentImpl::~DocumentImpl): Added some asserts to make sure we don't get destroyed
            while we are in the page cache.
            (DocumentImpl::attach): Added an assert.
            (DocumentImpl::setInPageCache): Save the renderer when setting the flag, and restore
            the renderer when clearing it.
    
            * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::openURLFromPageCache): Instead of doing a restoreRenderer
            call, just do setInPageCache(NO), which will restore the renderer as a side effect.
    
            * kwq/KWQPageState.h: Removed the renderer method and field.
            * kwq/KWQPageState.mm:
            (-[KWQPageState initWithDocument:URL:windowProperties:locationProperties:interpreterBuiltins:]):
            Don't store a pointer to the renderer.
            (-[KWQPageState clear]): New method, shared by invalidate and dealloc.
            (-[KWQPageState invalidate]): Removed code relating to "relinquishing object ownership";
            just deallocate everything here without doing a detach().
            (-[KWQPageState dealloc]): Removed restoreRenderer now that setInPageCache(NO) handles that.
            Added some assertions. Share code with invalidate by calling clear.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5848 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index a53cd8b..ee66a9f 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,35 @@
+2003-12-23  Darin Adler  <darin at apple.com>
+
+        Reviewed by John.
+
+        - another try at fixing the -[KWQPageState dealloc] bug, even though we don't fully understand it
+        
+        This change saves the renderer inside the document rather than in the KWQPageState to
+        try to eliminate the possibility that multiple KWQPageState objects could restore the
+        same renderer multiple times, resulting in multiple detaches of the same renderer.
+
+        * khtml/xml/dom_docimpl.h: Add a m_savedRenderer field.
+        * khtml/xml/dom_docimpl.cpp:
+        (DocumentImpl::DocumentImpl): Initialize m_savedRenderer to 0.
+        (DocumentImpl::~DocumentImpl): Added some asserts to make sure we don't get destroyed
+        while we are in the page cache.
+        (DocumentImpl::attach): Added an assert.
+        (DocumentImpl::setInPageCache): Save the renderer when setting the flag, and restore
+        the renderer when clearing it.
+
+        * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::openURLFromPageCache): Instead of doing a restoreRenderer
+        call, just do setInPageCache(NO), which will restore the renderer as a side effect.
+
+        * kwq/KWQPageState.h: Removed the renderer method and field.
+        * kwq/KWQPageState.mm:
+        (-[KWQPageState initWithDocument:URL:windowProperties:locationProperties:interpreterBuiltins:]):
+        Don't store a pointer to the renderer.
+        (-[KWQPageState clear]): New method, shared by invalidate and dealloc.
+        (-[KWQPageState invalidate]): Removed code relating to "relinquishing object ownership";
+        just deallocate everything here without doing a detach().
+        (-[KWQPageState dealloc]): Removed restoreRenderer now that setInPageCache(NO) handles that.
+        Added some assertions. Share code with invalidate by calling clear.
+
 2003-12-22  John Sullivan  <sullivan at apple.com>
 
         - fixed <rdar://problem/3508798>: ACCESSIBILITY: role/description/value strings not defined
diff --git a/WebCore/khtml/xml/dom_docimpl.cpp b/WebCore/khtml/xml/dom_docimpl.cpp
index d81ebd8..7048776 100644
--- a/WebCore/khtml/xml/dom_docimpl.cpp
+++ b/WebCore/khtml/xml/dom_docimpl.cpp
@@ -230,7 +230,8 @@ DocumentImpl::DocumentImpl(DOMImplementationImpl *_implementation, KHTMLView *v)
     , m_imageLoadEventTimer(0)
 #if APPLE_CHANGES
     , m_finishedParsing(this, SIGNAL(finishedParsing()))
-    , m_inPageCache(0), m_passwordFields(0), m_secureForms(0)
+    , m_inPageCache(false), m_savedRenderer(0)
+    , m_passwordFields(0), m_secureForms(0)
     , m_decoder(0), m_createRenderers(true)
 #endif
 {
@@ -314,6 +315,10 @@ DocumentImpl::DocumentImpl(DOMImplementationImpl *_implementation, KHTMLView *v)
 DocumentImpl::~DocumentImpl()
 {
     assert(!m_render);
+#if APPLE_CHANGES
+    assert(!m_inPageCache);
+    assert(m_savedRenderer == 0);
+#endif
     
     KJS::ScriptInterpreter::forgetDOMObjectsForDocument(this);
 
@@ -1089,6 +1094,9 @@ void DocumentImpl::updateLayout()
 void DocumentImpl::attach()
 {
     assert(!attached());
+#if APPLE_CHANGES
+    assert(!m_inPageCache);
+#endif
 
     if ( m_view )
         setPaintDevice( m_view );
@@ -2533,9 +2541,21 @@ bool DocumentImpl::inPageCache()
 
 void DocumentImpl::setInPageCache(bool flag)
 {
+    if (m_inPageCache == flag)
+        return;
+
     m_inPageCache = flag;
-    if (m_view && m_inPageCache)
-        m_view->resetScrollBars();
+    if (flag) {
+        assert(m_savedRenderer == 0);
+        m_savedRenderer = m_render;
+        if (m_view) {
+            m_view->resetScrollBars();
+        }
+    } else {
+        assert(m_render == 0 || m_render == m_savedRenderer);
+        m_render = m_savedRenderer;
+        m_savedRenderer = 0;
+    }
 }
 
 void DocumentImpl::passwordFieldAdded()
diff --git a/WebCore/khtml/xml/dom_docimpl.h b/WebCore/khtml/xml/dom_docimpl.h
index 63f39ca..7ce8e0f 100644
--- a/WebCore/khtml/xml/dom_docimpl.h
+++ b/WebCore/khtml/xml/dom_docimpl.h
@@ -593,6 +593,7 @@ public:
 private:
     mutable DOMString m_domain;
     bool m_inPageCache;
+    khtml::RenderObject *m_savedRenderer;
     int m_passwordFields;
     int m_secureForms;
     
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index acb6aa7..4bc4d31 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -1189,7 +1189,6 @@ void KWQKHTMLPart::openURLFromPageCache(KWQPageState *state)
     // does not throw
 
     DocumentImpl *doc = [state document];
-    RenderObject *renderer = [state renderer];
     KURL *url = [state URL];
     SavedProperties *windowProperties = [state windowProperties];
     SavedProperties *locationProperties = [state locationProperties];
@@ -1234,8 +1233,8 @@ void KWQKHTMLPart::openURLFromPageCache(KWQPageState *state)
     // -----------begin-----------
     clear();
 
-    doc->restoreRenderer(renderer);
-    
+    doc->setInPageCache(NO);
+
     d->m_bCleared = false;
     d->m_cacheId = 0;
     d->m_bComplete = false;
diff --git a/WebCore/kwq/KWQPageState.h b/WebCore/kwq/KWQPageState.h
index 17730ea..d39909f 100644
--- a/WebCore/kwq/KWQPageState.h
+++ b/WebCore/kwq/KWQPageState.h
@@ -35,10 +35,6 @@ namespace DOM {
     class DocumentImpl;
 }
 
-namespace khtml {
-    class RenderObject;
-}
-
 namespace KJS {
     class SavedProperties;
 }
@@ -50,7 +46,6 @@ namespace KJS {
     KJS::SavedProperties *windowProperties;
     KJS::SavedProperties *locationProperties;
     KJS::SavedBuiltins *interpreterBuiltins;
-    khtml::RenderObject *docRenderer; 
     QMap<int, KJS::ScheduledAction*> *pausedActions;
 }
 
@@ -61,7 +56,6 @@ namespace KJS {
 - (KJS::SavedProperties *)windowProperties;
 - (KJS::SavedProperties *)locationProperties;
 - (KJS::SavedBuiltins *)interpreterBuiltins;
-- (khtml::RenderObject *)renderer;
 - (void)setPausedActions: (QMap<int, KJS::ScheduledAction*> *)pa;
 - (QMap<int, KJS::ScheduledAction*> *)pausedActions;
 - (void)invalidate;
diff --git a/WebCore/kwq/KWQPageState.mm b/WebCore/kwq/KWQPageState.mm
index 9d9e118..c502c3f 100644
--- a/WebCore/kwq/KWQPageState.mm
+++ b/WebCore/kwq/KWQPageState.mm
@@ -48,7 +48,6 @@ using KJS::SavedBuiltins;
     [super init];
     doc->ref();
     document = doc;
-    docRenderer = doc->renderer();
     document->setInPageCache(YES);
     document->view()->ref();
     URL = new KURL(u);
@@ -82,62 +81,54 @@ using KJS::SavedBuiltins;
     QObject::clearPausedTimers(self);
 }
 
-// Called when the KWQPageState is restored.  It relinquishs ownership
-// of objects to core.
-- (void)invalidate
+- (void)clear
 {
-    // Should only ever invalidate once.
-    ASSERT(document);
-    
-    document->setInPageCache(NO);
-
-    // Do NOT detach the renderer here.  The ownership of the renderer
-    // has been handed off to core.  The renderer is being used in an
-    // active page.  It will be either cleaned up with the document or
-    // re-added to another page cache.
-    docRenderer = 0;
-
-    document->view()->deref();
-    document->deref();
     document = 0;
 
     delete URL;
     URL = 0;
-    
-    [self _cleanupPausedActions];
-    
     delete windowProperties;
     windowProperties = 0;
     delete locationProperties;
     locationProperties = 0;
     delete interpreterBuiltins;
     interpreterBuiltins = 0;
+    [self _cleanupPausedActions];
+}
+
+- (void)invalidate
+{
+    // Should only ever invalidate once.
+    ASSERT(document);
+    ASSERT(!document->inPageCache());
+
+    document->view()->deref();
+    document->deref();
+
+    [self clear];
 }
 
 - (void)dealloc
 {
     if (document) {
+        ASSERT(document->inPageCache());
+        ASSERT(document->view());
+
         KHTMLView *view = document->view();
 
         KWQKHTMLPart::clearTimers(view);
 
         document->setInPageCache(NO);
-        document->restoreRenderer(docRenderer);
         document->detach();
         document->deref();
         
         if (view) {
             view->clearPart();
-	    view->deref();
+            view->deref();
         }
     }
-    
-    delete URL;
-    delete windowProperties;
-    delete locationProperties;
-    delete interpreterBuiltins;
-    
-    [self _cleanupPausedActions];
+
+    [self clear];
 
     [super dealloc];
 }
@@ -167,9 +158,4 @@ using KJS::SavedBuiltins;
     return interpreterBuiltins;
 }
 
-- (RenderObject *)renderer
-{
-    return docRenderer;
-}
-
 @end

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list