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

rjw rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:00:00 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit a36d1d86d921906079e6d9e87d86cb18076025e6
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Apr 2 05:17:43 2002 +0000

            Cleaned up lots of potentially stale references to controller.
            Added ref count to part.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@928 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index c1d7e64..c876b4e 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,5 +1,15 @@
 2002-04-01  Richard Williamson  <rjw at apple.com>
 
+        Cleaned up lots of potentially stale references to controller.
+        Added ref count to part.
+        
+	* src/kwq/KWQKHTMLPart.h:
+	* src/kwq/KWQKHTMLPart.mm: (KHTMLPart::init):
+	* src/kwq/KWQKloader.mm: (-[URLLoadClient
+	IFURLHandle:resourceDataDidBecomeAvailable:]):
+
+2002-04-01  Richard Williamson  <rjw at apple.com>
+
         Changes to support correct behavior is i/frame margins and
         scroll views.
         
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index c1d7e64..c876b4e 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,5 +1,15 @@
 2002-04-01  Richard Williamson  <rjw at apple.com>
 
+        Cleaned up lots of potentially stale references to controller.
+        Added ref count to part.
+        
+	* src/kwq/KWQKHTMLPart.h:
+	* src/kwq/KWQKHTMLPart.mm: (KHTMLPart::init):
+	* src/kwq/KWQKloader.mm: (-[URLLoadClient
+	IFURLHandle:resourceDataDidBecomeAvailable:]):
+
+2002-04-01  Richard Williamson  <rjw at apple.com>
+
         Changes to support correct behavior is i/frame margins and
         scroll views.
         
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index c1d7e64..c876b4e 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,15 @@
 2002-04-01  Richard Williamson  <rjw at apple.com>
 
+        Cleaned up lots of potentially stale references to controller.
+        Added ref count to part.
+        
+	* src/kwq/KWQKHTMLPart.h:
+	* src/kwq/KWQKHTMLPart.mm: (KHTMLPart::init):
+	* src/kwq/KWQKloader.mm: (-[URLLoadClient
+	IFURLHandle:resourceDataDidBecomeAvailable:]):
+
+2002-04-01  Richard Williamson  <rjw at apple.com>
+
         Changes to support correct behavior is i/frame margins and
         scroll views.
         
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index bb9a84f..2eb0223 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -238,6 +238,7 @@ KHTMLPart::KHTMLPart(const KURL &url)
 void KHTMLPart::init()
 {
     d = new KHTMLPartPrivate(this);
+    _ref = 1;
 }
 
 KHTMLPart::~KHTMLPart()
diff --git a/WebCore/kwq/KWQKHTMLPartImpl.mm b/WebCore/kwq/KWQKHTMLPartImpl.mm
index bb9a84f..2eb0223 100644
--- a/WebCore/kwq/KWQKHTMLPartImpl.mm
+++ b/WebCore/kwq/KWQKHTMLPartImpl.mm
@@ -238,6 +238,7 @@ KHTMLPart::KHTMLPart(const KURL &url)
 void KHTMLPart::init()
 {
     d = new KHTMLPartPrivate(this);
+    _ref = 1;
 }
 
 KHTMLPart::~KHTMLPart()
diff --git a/WebCore/kwq/KWQKloader.mm b/WebCore/kwq/KWQKloader.mm
index c522740..f9995cf 100644
--- a/WebCore/kwq/KWQKloader.mm
+++ b/WebCore/kwq/KWQKloader.mm
@@ -1095,7 +1095,6 @@ void DocLoader::removeCachedObject( CachedObject* o ) const
     m_loader->slotData(job, (const char *)[data bytes], [data length]);    
 
     id controller;
-    
 
     IFLoadProgress *loadProgress = WCIFLoadProgressMake();
     loadProgress->totalToLoad = [sender contentLength];
diff --git a/WebCore/kwq/KWQLoader.mm b/WebCore/kwq/KWQLoader.mm
index c522740..f9995cf 100644
--- a/WebCore/kwq/KWQLoader.mm
+++ b/WebCore/kwq/KWQLoader.mm
@@ -1095,7 +1095,6 @@ void DocLoader::removeCachedObject( CachedObject* o ) const
     m_loader->slotData(job, (const char *)[data bytes], [data length]);    
 
     id controller;
-    
 
     IFLoadProgress *loadProgress = WCIFLoadProgressMake();
     loadProgress->totalToLoad = [sender contentLength];
diff --git a/WebCore/kwq/KWQLoaderImpl.mm b/WebCore/kwq/KWQLoaderImpl.mm
index c522740..f9995cf 100644
--- a/WebCore/kwq/KWQLoaderImpl.mm
+++ b/WebCore/kwq/KWQLoaderImpl.mm
@@ -1095,7 +1095,6 @@ void DocLoader::removeCachedObject( CachedObject* o ) const
     m_loader->slotData(job, (const char *)[data bytes], [data length]);    
 
     id controller;
-    
 
     IFLoadProgress *loadProgress = WCIFLoadProgressMake();
     loadProgress->totalToLoad = [sender contentLength];
diff --git a/WebCore/src/kwq/KWQKHTMLPart.h b/WebCore/src/kwq/KWQKHTMLPart.h
index 75a23d7..f3ee5c8 100644
--- a/WebCore/src/kwq/KWQKHTMLPart.h
+++ b/WebCore/src/kwq/KWQKHTMLPart.h
@@ -601,6 +601,11 @@ public:
     QString documentSource();
     
     void init();
+    
+    void ref() { _ref++; }
+    void deref() { if(_ref) _ref--; if(!_ref) delete this; }
+
+
     void slotData(IFURLHandle *handle, const char *bytes, int length);  
 #endif
 
@@ -625,6 +630,7 @@ private:
 #ifdef APPLE_CHANGES
     IFWebDataSource *dataSource;
     QValueList<QString> plugins;
+    unsigned int _ref;
 #endif
 };
 
diff --git a/WebCore/src/kwq/KWQKHTMLPart.mm b/WebCore/src/kwq/KWQKHTMLPart.mm
index bb9a84f..2eb0223 100644
--- a/WebCore/src/kwq/KWQKHTMLPart.mm
+++ b/WebCore/src/kwq/KWQKHTMLPart.mm
@@ -238,6 +238,7 @@ KHTMLPart::KHTMLPart(const KURL &url)
 void KHTMLPart::init()
 {
     d = new KHTMLPartPrivate(this);
+    _ref = 1;
 }
 
 KHTMLPart::~KHTMLPart()
diff --git a/WebCore/src/kwq/KWQKloader.mm b/WebCore/src/kwq/KWQKloader.mm
index c522740..f9995cf 100644
--- a/WebCore/src/kwq/KWQKloader.mm
+++ b/WebCore/src/kwq/KWQKloader.mm
@@ -1095,7 +1095,6 @@ void DocLoader::removeCachedObject( CachedObject* o ) const
     m_loader->slotData(job, (const char *)[data bytes], [data length]);    
 
     id controller;
-    
 
     IFLoadProgress *loadProgress = WCIFLoadProgressMake();
     loadProgress->totalToLoad = [sender contentLength];
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 556f439..19a2967 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,5 +1,24 @@
 2002-04-01  Richard Williamson  <rjw at apple.com>
 
+        Cleaned up lots of potentially stale references to controller.
+        
+	* WebView.subproj/IFBaseWebControllerPrivate.mm: (-[IFBaseWebControllerPrivate
+	dealloc]):
+	* WebView.subproj/IFMainURLHandleClient.mm: (-[IFMainURLHandleClient
+	initWithDataSource:part:]), (-[IFMainURLHandleClient dealloc]):
+	* WebView.subproj/IFWebDataSource.h:
+	* WebView.subproj/IFWebDataSource.mm:
+	* WebView.subproj/IFWebDataSourcePrivate.mm: (-[IFWebDataSourcePrivate dealloc]),
+	(-[IFWebDataSource _setPrimaryLoadComplete:]), (-[IFWebDataSource _setTitle:]):
+	* WebView.subproj/IFWebFramePrivate.h:
+	* WebView.subproj/IFWebFramePrivate.mm: (-[IFWebFramePrivate dealloc]),
+	(-[IFWebFramePrivate setDataSource:]), (-[IFWebFramePrivate
+	setProvisionalDataSource:]), (-[IFWebFrame _setController:]), (-[IFWebFrame
+	_transitionProvisionalToCommitted]), (-[IFWebFrame _timedLayout:]), (-[IFWebFrame
+	_setState:]):
+
+2002-04-01  Richard Williamson  <rjw at apple.com>
+
         Logging changes.
         Changes to support correct i/frame behavior.
     
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 556f439..19a2967 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,5 +1,24 @@
 2002-04-01  Richard Williamson  <rjw at apple.com>
 
+        Cleaned up lots of potentially stale references to controller.
+        
+	* WebView.subproj/IFBaseWebControllerPrivate.mm: (-[IFBaseWebControllerPrivate
+	dealloc]):
+	* WebView.subproj/IFMainURLHandleClient.mm: (-[IFMainURLHandleClient
+	initWithDataSource:part:]), (-[IFMainURLHandleClient dealloc]):
+	* WebView.subproj/IFWebDataSource.h:
+	* WebView.subproj/IFWebDataSource.mm:
+	* WebView.subproj/IFWebDataSourcePrivate.mm: (-[IFWebDataSourcePrivate dealloc]),
+	(-[IFWebDataSource _setPrimaryLoadComplete:]), (-[IFWebDataSource _setTitle:]):
+	* WebView.subproj/IFWebFramePrivate.h:
+	* WebView.subproj/IFWebFramePrivate.mm: (-[IFWebFramePrivate dealloc]),
+	(-[IFWebFramePrivate setDataSource:]), (-[IFWebFramePrivate
+	setProvisionalDataSource:]), (-[IFWebFrame _setController:]), (-[IFWebFrame
+	_transitionProvisionalToCommitted]), (-[IFWebFrame _timedLayout:]), (-[IFWebFrame
+	_setState:]):
+
+2002-04-01  Richard Williamson  <rjw at apple.com>
+
         Logging changes.
         Changes to support correct i/frame behavior.
     
diff --git a/WebKit/WebView.subproj/IFBaseWebControllerPrivate.mm b/WebKit/WebView.subproj/IFBaseWebControllerPrivate.mm
index a79575a..ae20eeb 100644
--- a/WebKit/WebView.subproj/IFBaseWebControllerPrivate.mm
+++ b/WebKit/WebView.subproj/IFBaseWebControllerPrivate.mm
@@ -26,6 +26,7 @@
 - (void)dealloc
 {
     [mainFrame reset];
+    [mainFrame _setController: nil];
     [mainFrame autorelease];
     [super dealloc];
 }
diff --git a/WebKit/WebView.subproj/IFMainURLHandleClient.mm b/WebKit/WebView.subproj/IFMainURLHandleClient.mm
index 07ec3e8..42435b5 100644
--- a/WebKit/WebView.subproj/IFMainURLHandleClient.mm
+++ b/WebKit/WebView.subproj/IFMainURLHandleClient.mm
@@ -16,14 +16,22 @@
 - initWithDataSource: (IFWebDataSource *)ds part:(KHTMLPart *)p
 {
     if ((self = [super init])) {
-        dataSource = ds;	// Non-retained.
+        dataSource = [ds retain];
         part = p;
+        part->ref();
         return self;
     }
 
     return nil;
 }
 
+- (void)dealloc
+{
+    part->deref();
+    [dataSource release];
+    [super dealloc];
+}
+
 - (void)IFURLHandleResourceDidBeginLoading:(IFURLHandle *)sender
 {
     WEBKITDEBUGLEVEL1 (WEBKIT_LOG_LOADING, "url = %s\n", [[[sender url] absoluteString] cString]);
diff --git a/WebKit/WebView.subproj/IFWebDataSource.h b/WebKit/WebView.subproj/IFWebDataSource.h
index f565935..a9ff3e8 100644
--- a/WebKit/WebView.subproj/IFWebDataSource.h
+++ b/WebKit/WebView.subproj/IFWebDataSource.h
@@ -113,9 +113,8 @@
 - (void)addFrame: (IFWebFrame *)frame;
 
 
-// Returns an array of IFWebFrame.  The data sources in the array are
-// the data source assoicated with a frame set or iframe.  If the main document
-// is not a frameset, or has not iframes children will return nil.
+// Returns an array of IFWebFrame.  The frames in the array are
+// associated with a frame set or iframe.
 - (NSArray *)children;
 
 
diff --git a/WebKit/WebView.subproj/IFWebDataSource.mm b/WebKit/WebView.subproj/IFWebDataSource.mm
index 054799d..c129085 100644
--- a/WebKit/WebView.subproj/IFWebDataSource.mm
+++ b/WebKit/WebView.subproj/IFWebDataSource.mm
@@ -87,9 +87,8 @@ static id IFWebDataSourceMake(void *url)
 }
 
 
-// Returns an array of IFWebDataSource.  The data sources in the array are
-// the data source assoicated with a frame set or iframe.  If the main document
-// is not a frameset, or has not iframes children will return nil.
+// Returns an array of IFWebFrame.  The frames in the array are
+// associated with a frame set or iframe.
 - (NSArray *)children
 {
     return [((IFWebDataSourcePrivate *)_dataSourcePrivate)->frames allValues];
diff --git a/WebKit/WebView.subproj/IFWebDataSourcePrivate.mm b/WebKit/WebView.subproj/IFWebDataSourcePrivate.mm
index 0622e95..ec2403a 100644
--- a/WebKit/WebView.subproj/IFWebDataSourcePrivate.mm
+++ b/WebKit/WebView.subproj/IFWebDataSourcePrivate.mm
@@ -35,6 +35,15 @@
     // controller is not retained!  IFWebControllers maintain
     // a reference to the main frame, which in turn refers to it's
     // view and data source.
+    int i, count;
+    NSArray *childFrames = [frames allValues];
+    
+    controller = nil;
+    
+    count = [childFrames count];
+    for (i = 0; i < count; i++){
+        [(IFWebFrame *)[childFrames objectAtIndex: i] _setController: nil];
+    }
     [frames release];
     [inputURL release];
     [urlHandles release];
@@ -42,7 +51,8 @@
     [mainURLHandleClient release];
     [pageTitle autorelease];
     
-    delete part;
+    part->deref();
+    part = 0;
 
     [super dealloc];
 }
@@ -77,6 +87,12 @@
     IFWebDataSourcePrivate *data = (IFWebDataSourcePrivate *)_dataSourcePrivate;
     
     data->primaryLoadComplete = flag;
+    if (flag == YES){
+        [data->mainURLHandleClient release];
+        data->mainURLHandleClient = 0; 
+        [data->mainHandle autorelease];
+        data->mainHandle = 0; 
+    }
 }
 
 - (void)_startLoading: (BOOL)forceRefresh
@@ -209,7 +225,9 @@
     
     [data->pageTitle autorelease];
     data->pageTitle = [[NSString stringWithString:trimmed] retain];
-    [data->controller receivedPageTitle:data->pageTitle forDataSource:self];
+    
+    // The title doesn't get communicated to the controller until
+    // we reach the committed state for this datasource's frame.
 }
 
 @end
diff --git a/WebKit/WebView.subproj/IFWebFramePrivate.h b/WebKit/WebView.subproj/IFWebFramePrivate.h
index fc206c6..1cd002c 100644
--- a/WebKit/WebView.subproj/IFWebFramePrivate.h
+++ b/WebKit/WebView.subproj/IFWebFramePrivate.h
@@ -55,6 +55,7 @@ typedef enum {
 @end
 
 @interface IFWebFrame (IFPrivate)
+- (void)_setController: (id <IFWebController>)controller;
 - (void)_setRenderFramePart: (void *)p;
 - (void *)_renderFramePart;
 - (void)_setDataSource: (IFWebDataSource *)d;
diff --git a/WebKit/WebView.subproj/IFWebFramePrivate.mm b/WebKit/WebView.subproj/IFWebFramePrivate.mm
index b84e050..3706962 100644
--- a/WebKit/WebView.subproj/IFWebFramePrivate.mm
+++ b/WebKit/WebView.subproj/IFWebFramePrivate.mm
@@ -21,8 +21,11 @@
 - (void)dealloc
 {
     [name autorelease];
+    [view _setController: nil];
     [view autorelease];
+    [dataSource _setController: nil];
     [dataSource autorelease];
+    [provisionalDataSource _setController: nil];
     [provisionalDataSource autorelease];
     [errors release];
     [mainDocumentError release];
@@ -48,9 +51,12 @@
 
 - (IFWebDataSource *)dataSource { return dataSource; }
 - (void)setDataSource: (IFWebDataSource *)d
-{ 
-    [dataSource autorelease];
-    dataSource = [d retain];
+{
+    if (dataSource != d){
+        [dataSource _setController: nil];
+        [dataSource autorelease];
+        dataSource = [d retain];
+    }
 }
 
 
@@ -65,8 +71,10 @@
 - (IFWebDataSource *)provisionalDataSource { return provisionalDataSource; }
 - (void)setProvisionalDataSource: (IFWebDataSource *)d
 { 
-    [provisionalDataSource autorelease];
-    provisionalDataSource = [d retain];
+    if (provisionalDataSource != d){
+        [provisionalDataSource autorelease];
+        provisionalDataSource = [d retain];
+    }
 }
 
 
@@ -85,6 +93,11 @@
 
 
 @implementation IFWebFrame (IFPrivate)
+- (void)_setController: (id <IFWebController>)controller
+{
+    IFWebFramePrivate *data = (IFWebFramePrivate *)_framePrivate;
+    [data setController: controller];
+}
 
 
 // renderFramePart is a pointer to a RenderPart
@@ -209,6 +222,10 @@ char *stateNames[6] = {
         
             [[self controller] locationChangeCommittedForFrame: self];
             
+            // If we have a title let the controller know about it.
+            if ([[self dataSource] pageTitle])
+                [[self controller] receivedPageTitle:[[self dataSource] pageTitle] forDataSource:[self dataSource]];
+
             break;
         }
         
@@ -232,12 +249,14 @@ char *stateNames[6] = {
     WEBKITDEBUGLEVEL2 (WEBKIT_LOG_TIMING, "%s:  state = %s\n", [[self name] cString], stateNames[data->state]);
     
     if (data->state == IFWEBFRAMESTATE_LAYOUT_ACCEPTABLE){
-        WEBKITDEBUGLEVEL2 (WEBKIT_LOG_TIMING, "%s:  performing timed layout, %f seconds since start of document load\n", [[self name] cString], CFAbsoluteTimeGetCurrent() - [[[[self controller] mainFrame] dataSource] _loadingStartedTime]);
+        if ([self controller])
+            WEBKITDEBUGLEVEL2 (WEBKIT_LOG_TIMING, "%s:  performing timed layout, %f seconds since start of document load\n", [[self name] cString], CFAbsoluteTimeGetCurrent() - [[[[self controller] mainFrame] dataSource] _loadingStartedTime]);
         [[self view] setNeedsLayout: YES];
         [[self view] setNeedsDisplay: YES];
     }
     else {
-        WEBKITDEBUGLEVEL2 (WEBKIT_LOG_TIMING, "%s:  NOT performing timed layout (not needed), %f seconds since start of document load\n", [[self name] cString], CFAbsoluteTimeGetCurrent() - [[[[self controller] mainFrame] dataSource] _loadingStartedTime]);
+        if ([self controller])
+            WEBKITDEBUGLEVEL2 (WEBKIT_LOG_TIMING, "%s:  NOT performing timed layout (not needed), %f seconds since start of document load\n", [[self name] cString], CFAbsoluteTimeGetCurrent() - [[[[self controller] mainFrame] dataSource] _loadingStartedTime]);
     }
 }
 
@@ -253,7 +272,8 @@ char *stateNames[6] = {
     IFWebFramePrivate *data = (IFWebFramePrivate *)_framePrivate;
 
     WEBKITDEBUGLEVEL3 (WEBKIT_LOG_LOADING, "%s:  transition from %s to %s\n", [[self name] cString], stateNames[data->state], stateNames[newState]);
-    WEBKITDEBUGLEVEL4 (WEBKIT_LOG_TIMING, "%s:  transition from %s to %s, %f seconds since start of document load\n", [[self name] cString], stateNames[data->state], stateNames[newState], CFAbsoluteTimeGetCurrent() - [[[[self controller] mainFrame] dataSource] _loadingStartedTime]);
+    if ([self controller])
+        WEBKITDEBUGLEVEL4 (WEBKIT_LOG_TIMING, "%s:  transition from %s to %s, %f seconds since start of document load\n", [[self name] cString], stateNames[data->state], stateNames[newState], CFAbsoluteTimeGetCurrent() - [[[[self controller] mainFrame] dataSource] _loadingStartedTime]);
     
     data->state = newState;
 }
diff --git a/WebKit/WebView.subproj/WebDataSource.h b/WebKit/WebView.subproj/WebDataSource.h
index f565935..a9ff3e8 100644
--- a/WebKit/WebView.subproj/WebDataSource.h
+++ b/WebKit/WebView.subproj/WebDataSource.h
@@ -113,9 +113,8 @@
 - (void)addFrame: (IFWebFrame *)frame;
 
 
-// Returns an array of IFWebFrame.  The data sources in the array are
-// the data source assoicated with a frame set or iframe.  If the main document
-// is not a frameset, or has not iframes children will return nil.
+// Returns an array of IFWebFrame.  The frames in the array are
+// associated with a frame set or iframe.
 - (NSArray *)children;
 
 
diff --git a/WebKit/WebView.subproj/WebDataSource.m b/WebKit/WebView.subproj/WebDataSource.m
index 054799d..c129085 100644
--- a/WebKit/WebView.subproj/WebDataSource.m
+++ b/WebKit/WebView.subproj/WebDataSource.m
@@ -87,9 +87,8 @@ static id IFWebDataSourceMake(void *url)
 }
 
 
-// Returns an array of IFWebDataSource.  The data sources in the array are
-// the data source assoicated with a frame set or iframe.  If the main document
-// is not a frameset, or has not iframes children will return nil.
+// Returns an array of IFWebFrame.  The frames in the array are
+// associated with a frame set or iframe.
 - (NSArray *)children
 {
     return [((IFWebDataSourcePrivate *)_dataSourcePrivate)->frames allValues];
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index 0622e95..ec2403a 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -35,6 +35,15 @@
     // controller is not retained!  IFWebControllers maintain
     // a reference to the main frame, which in turn refers to it's
     // view and data source.
+    int i, count;
+    NSArray *childFrames = [frames allValues];
+    
+    controller = nil;
+    
+    count = [childFrames count];
+    for (i = 0; i < count; i++){
+        [(IFWebFrame *)[childFrames objectAtIndex: i] _setController: nil];
+    }
     [frames release];
     [inputURL release];
     [urlHandles release];
@@ -42,7 +51,8 @@
     [mainURLHandleClient release];
     [pageTitle autorelease];
     
-    delete part;
+    part->deref();
+    part = 0;
 
     [super dealloc];
 }
@@ -77,6 +87,12 @@
     IFWebDataSourcePrivate *data = (IFWebDataSourcePrivate *)_dataSourcePrivate;
     
     data->primaryLoadComplete = flag;
+    if (flag == YES){
+        [data->mainURLHandleClient release];
+        data->mainURLHandleClient = 0; 
+        [data->mainHandle autorelease];
+        data->mainHandle = 0; 
+    }
 }
 
 - (void)_startLoading: (BOOL)forceRefresh
@@ -209,7 +225,9 @@
     
     [data->pageTitle autorelease];
     data->pageTitle = [[NSString stringWithString:trimmed] retain];
-    [data->controller receivedPageTitle:data->pageTitle forDataSource:self];
+    
+    // The title doesn't get communicated to the controller until
+    // we reach the committed state for this datasource's frame.
 }
 
 @end
diff --git a/WebKit/WebView.subproj/WebFramePrivate.h b/WebKit/WebView.subproj/WebFramePrivate.h
index fc206c6..1cd002c 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.h
+++ b/WebKit/WebView.subproj/WebFramePrivate.h
@@ -55,6 +55,7 @@ typedef enum {
 @end
 
 @interface IFWebFrame (IFPrivate)
+- (void)_setController: (id <IFWebController>)controller;
 - (void)_setRenderFramePart: (void *)p;
 - (void *)_renderFramePart;
 - (void)_setDataSource: (IFWebDataSource *)d;
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index b84e050..3706962 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -21,8 +21,11 @@
 - (void)dealloc
 {
     [name autorelease];
+    [view _setController: nil];
     [view autorelease];
+    [dataSource _setController: nil];
     [dataSource autorelease];
+    [provisionalDataSource _setController: nil];
     [provisionalDataSource autorelease];
     [errors release];
     [mainDocumentError release];
@@ -48,9 +51,12 @@
 
 - (IFWebDataSource *)dataSource { return dataSource; }
 - (void)setDataSource: (IFWebDataSource *)d
-{ 
-    [dataSource autorelease];
-    dataSource = [d retain];
+{
+    if (dataSource != d){
+        [dataSource _setController: nil];
+        [dataSource autorelease];
+        dataSource = [d retain];
+    }
 }
 
 
@@ -65,8 +71,10 @@
 - (IFWebDataSource *)provisionalDataSource { return provisionalDataSource; }
 - (void)setProvisionalDataSource: (IFWebDataSource *)d
 { 
-    [provisionalDataSource autorelease];
-    provisionalDataSource = [d retain];
+    if (provisionalDataSource != d){
+        [provisionalDataSource autorelease];
+        provisionalDataSource = [d retain];
+    }
 }
 
 
@@ -85,6 +93,11 @@
 
 
 @implementation IFWebFrame (IFPrivate)
+- (void)_setController: (id <IFWebController>)controller
+{
+    IFWebFramePrivate *data = (IFWebFramePrivate *)_framePrivate;
+    [data setController: controller];
+}
 
 
 // renderFramePart is a pointer to a RenderPart
@@ -209,6 +222,10 @@ char *stateNames[6] = {
         
             [[self controller] locationChangeCommittedForFrame: self];
             
+            // If we have a title let the controller know about it.
+            if ([[self dataSource] pageTitle])
+                [[self controller] receivedPageTitle:[[self dataSource] pageTitle] forDataSource:[self dataSource]];
+
             break;
         }
         
@@ -232,12 +249,14 @@ char *stateNames[6] = {
     WEBKITDEBUGLEVEL2 (WEBKIT_LOG_TIMING, "%s:  state = %s\n", [[self name] cString], stateNames[data->state]);
     
     if (data->state == IFWEBFRAMESTATE_LAYOUT_ACCEPTABLE){
-        WEBKITDEBUGLEVEL2 (WEBKIT_LOG_TIMING, "%s:  performing timed layout, %f seconds since start of document load\n", [[self name] cString], CFAbsoluteTimeGetCurrent() - [[[[self controller] mainFrame] dataSource] _loadingStartedTime]);
+        if ([self controller])
+            WEBKITDEBUGLEVEL2 (WEBKIT_LOG_TIMING, "%s:  performing timed layout, %f seconds since start of document load\n", [[self name] cString], CFAbsoluteTimeGetCurrent() - [[[[self controller] mainFrame] dataSource] _loadingStartedTime]);
         [[self view] setNeedsLayout: YES];
         [[self view] setNeedsDisplay: YES];
     }
     else {
-        WEBKITDEBUGLEVEL2 (WEBKIT_LOG_TIMING, "%s:  NOT performing timed layout (not needed), %f seconds since start of document load\n", [[self name] cString], CFAbsoluteTimeGetCurrent() - [[[[self controller] mainFrame] dataSource] _loadingStartedTime]);
+        if ([self controller])
+            WEBKITDEBUGLEVEL2 (WEBKIT_LOG_TIMING, "%s:  NOT performing timed layout (not needed), %f seconds since start of document load\n", [[self name] cString], CFAbsoluteTimeGetCurrent() - [[[[self controller] mainFrame] dataSource] _loadingStartedTime]);
     }
 }
 
@@ -253,7 +272,8 @@ char *stateNames[6] = {
     IFWebFramePrivate *data = (IFWebFramePrivate *)_framePrivate;
 
     WEBKITDEBUGLEVEL3 (WEBKIT_LOG_LOADING, "%s:  transition from %s to %s\n", [[self name] cString], stateNames[data->state], stateNames[newState]);
-    WEBKITDEBUGLEVEL4 (WEBKIT_LOG_TIMING, "%s:  transition from %s to %s, %f seconds since start of document load\n", [[self name] cString], stateNames[data->state], stateNames[newState], CFAbsoluteTimeGetCurrent() - [[[[self controller] mainFrame] dataSource] _loadingStartedTime]);
+    if ([self controller])
+        WEBKITDEBUGLEVEL4 (WEBKIT_LOG_TIMING, "%s:  transition from %s to %s, %f seconds since start of document load\n", [[self name] cString], stateNames[data->state], stateNames[newState], CFAbsoluteTimeGetCurrent() - [[[[self controller] mainFrame] dataSource] _loadingStartedTime]);
     
     data->state = newState;
 }
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index 07ec3e8..42435b5 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -16,14 +16,22 @@
 - initWithDataSource: (IFWebDataSource *)ds part:(KHTMLPart *)p
 {
     if ((self = [super init])) {
-        dataSource = ds;	// Non-retained.
+        dataSource = [ds retain];
         part = p;
+        part->ref();
         return self;
     }
 
     return nil;
 }
 
+- (void)dealloc
+{
+    part->deref();
+    [dataSource release];
+    [super dealloc];
+}
+
 - (void)IFURLHandleResourceDidBeginLoading:(IFURLHandle *)sender
 {
     WEBKITDEBUGLEVEL1 (WEBKIT_LOG_LOADING, "url = %s\n", [[[sender url] absoluteString] cString]);
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index 07ec3e8..42435b5 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -16,14 +16,22 @@
 - initWithDataSource: (IFWebDataSource *)ds part:(KHTMLPart *)p
 {
     if ((self = [super init])) {
-        dataSource = ds;	// Non-retained.
+        dataSource = [ds retain];
         part = p;
+        part->ref();
         return self;
     }
 
     return nil;
 }
 
+- (void)dealloc
+{
+    part->deref();
+    [dataSource release];
+    [super dealloc];
+}
+
 - (void)IFURLHandleResourceDidBeginLoading:(IFURLHandle *)sender
 {
     WEBKITDEBUGLEVEL1 (WEBKIT_LOG_LOADING, "url = %s\n", [[[sender url] absoluteString] cString]);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list