[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 06:20:58 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 400647970230f8799646ec66eb712e097c0fe595
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jun 24 19:13:37 2002 +0000

    WebCore:
    
            * khtml/khtmlview.cpp: (KHTMLView::~KHTMLView): Put APPLE_CHANGES
            later in the sequence so we don't deref the part before the code
            gets to run.
    
            * kwq/kwqdebug.h: Re-add the __format__ attribute, now that Radar
            2920557 is fixed.
    
    WebKit:
    
            Fix the last of the "leak the world" problems. The KHTMLView was leaking
            in IFHTMLView.
    
            * WebView.subproj/IFHTMLView.mm:
            (-[IFHTMLView dealloc]): Call _reset instead of _stopPlugins, so we get rid
            of the widget too.
            (-[IFHTMLView viewWillMoveToWindow:]): Use _reset now instead of the old
            _stopPlugins; also check that the window isn't already nil so we don't do a
            reset as part of our first install.
            (-[IFHTMLView provisionalDataSourceCommitted:]): Use the new widgetOwned
            flag to tell if the widget should be deleted instead of deciding based on
            whether the dataSource is the main document.
    
            * WebView.subproj/IFHTMLViewPrivate.h: Add a widgetOwned boolean and a
            private _takeOwnershipOfWidget method. Combine _resetWidget and _stopPlugins
            into a single _reset call. Remove _removeSubviews.
    
            * WebView.subproj/IFHTMLViewPrivate.mm:
            (-[IFHTMLView _reset]): New name for the combination of _resetWidget and
            _stopPlugins. Now it decides whether to delete the widget based on the
            widget owned flag, so it is safe to call even for non-main-document views.
            (-[IFHTMLView _takeOwnershipOfWidget]): Sets widgetOwned to NO.
    
            * WebView.subproj/IFWebFrame.mm: (-[IFWebFrame reset]): Use _resetWidget
            under its new name _reset.
    
            * WebView.subproj/IFWebFramePrivate.mm:
            (-[IFWebFrame _transitionProvisionalToCommitted]): Don't bother doing
            explicit _stopPlugins and _removeSubviews. It's now the view's own responsibility
            to do this in viewWillMoveToWindow:. Call _takeOwnershipOfWidget after attaching
            the widget to the RenderPart.
    
            * WebView.subproj/IFImageView.m: (-[IFImageView viewWillMoveToWindow:]): Added.
            Break the reference cycle by stopping animated IFImageRenderer here instead of
            waiting for dealloc.
    
            * Plugins.subproj/IFPluginView.mm: (-[IFPluginView setWindow]): Fix a warning
            by changing the printf format string to match the parameter type.
    
            * Misc.subproj/WebKitDebug.h: Re-add the __format__ attribute, now that Radar
            2920557 is fixed.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1419 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 040b87e..e141de9 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,12 @@
+2002-06-24  Darin Adler  <darin at apple.com>
+
+        * khtml/khtmlview.cpp: (KHTMLView::~KHTMLView): Put APPLE_CHANGES
+        later in the sequence so we don't deref the part before the code
+        gets to run.
+
+        * kwq/kwqdebug.h: Re-add the __format__ attribute, now that Radar
+        2920557 is fixed.
+
 2002-06-21  Darin Adler  <darin at apple.com>
 
         * kwq/KWQFont.mm: Made it store a copy of the family name instead of
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 040b87e..e141de9 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,12 @@
+2002-06-24  Darin Adler  <darin at apple.com>
+
+        * khtml/khtmlview.cpp: (KHTMLView::~KHTMLView): Put APPLE_CHANGES
+        later in the sequence so we don't deref the part before the code
+        gets to run.
+
+        * kwq/kwqdebug.h: Re-add the __format__ attribute, now that Radar
+        2920557 is fixed.
+
 2002-06-21  Darin Adler  <darin at apple.com>
 
         * kwq/KWQFont.mm: Made it store a copy of the family name instead of
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 040b87e..e141de9 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,12 @@
+2002-06-24  Darin Adler  <darin at apple.com>
+
+        * khtml/khtmlview.cpp: (KHTMLView::~KHTMLView): Put APPLE_CHANGES
+        later in the sequence so we don't deref the part before the code
+        gets to run.
+
+        * kwq/kwqdebug.h: Re-add the __format__ attribute, now that Radar
+        2920557 is fixed.
+
 2002-06-21  Darin Adler  <darin at apple.com>
 
         * kwq/KWQFont.mm: Made it store a copy of the family name instead of
diff --git a/WebCore/khtml/khtmlview.cpp b/WebCore/khtml/khtmlview.cpp
index 81598ad..fa8df59 100644
--- a/WebCore/khtml/khtmlview.cpp
+++ b/WebCore/khtml/khtmlview.cpp
@@ -234,6 +234,12 @@ KHTMLView::~KHTMLView()
 {
     if (m_part)
     {
+        //WABA: Is this Ok? Do I need to deref it as well?
+        //Does this need to be done somewhere else?
+        DOM::DocumentImpl *doc = m_part->xmlDocImpl();
+        if (doc)
+            doc->detach();
+
 #ifdef APPLE_CHANGES
         killTimer(d->timerId);
         killTimer(d->repaintTimerId);
@@ -241,12 +247,6 @@ KHTMLView::~KHTMLView()
         d->repaintTimerId = 0;
         m_part->deref();
 #endif
-        
-        //WABA: Is this Ok? Do I need to deref it as well?
-        //Does this need to be done somewhere else?
-        DOM::DocumentImpl *doc = m_part->xmlDocImpl();
-        if (doc)
-            doc->detach();
     }
     delete d; d = 0;
 }
diff --git a/WebCore/kwq/kwqdebug.h b/WebCore/kwq/kwqdebug.h
index 9f74d96..14534c0 100644
--- a/WebCore/kwq/kwqdebug.h
+++ b/WebCore/kwq/kwqdebug.h
@@ -69,11 +69,7 @@ long _GetMillisecondsSinceEpoch();
 
 void KWQSetLogLevel(int mask);
 unsigned int KWQGetLogLevel();
-void KWQLog(unsigned int level, const char *file, int line, const char *function, const char *format, ...)
-// FIXME: When Radar 2920557 is fixed, we can add this back and turn the -Wmissing-format-attribute
-// switch back on. PFE precompiled headers currently prevent this from working.
-//    __attribute__((__format__ (__printf__, 5, 6)))
-;
+void KWQLog(unsigned int level, const char *file, int line, const char *function, const char *format, ...) __attribute__((__format__ (__printf__, 5, 6)));
 
 #define DEBUG_OBJECT(object) [[object description] lossyCString]
 
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index d678928..0ed541e 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,47 @@
+2002-06-24  Darin Adler  <darin at apple.com>
+
+        Fix the last of the "leak the world" problems. The KHTMLView was leaking
+        in IFHTMLView.
+
+        * WebView.subproj/IFHTMLView.mm:
+        (-[IFHTMLView dealloc]): Call _reset instead of _stopPlugins, so we get rid
+        of the widget too.
+        (-[IFHTMLView viewWillMoveToWindow:]): Use _reset now instead of the old
+        _stopPlugins; also check that the window isn't already nil so we don't do a
+        reset as part of our first install.
+        (-[IFHTMLView provisionalDataSourceCommitted:]): Use the new widgetOwned
+        flag to tell if the widget should be deleted instead of deciding based on
+        whether the dataSource is the main document.
+
+        * WebView.subproj/IFHTMLViewPrivate.h: Add a widgetOwned boolean and a
+        private _takeOwnershipOfWidget method. Combine _resetWidget and _stopPlugins
+        into a single _reset call. Remove _removeSubviews.
+
+        * WebView.subproj/IFHTMLViewPrivate.mm:
+        (-[IFHTMLView _reset]): New name for the combination of _resetWidget and
+        _stopPlugins. Now it decides whether to delete the widget based on the
+        widget owned flag, so it is safe to call even for non-main-document views.
+        (-[IFHTMLView _takeOwnershipOfWidget]): Sets widgetOwned to NO.
+
+        * WebView.subproj/IFWebFrame.mm: (-[IFWebFrame reset]): Use _resetWidget
+        under its new name _reset.
+
+        * WebView.subproj/IFWebFramePrivate.mm:
+        (-[IFWebFrame _transitionProvisionalToCommitted]): Don't bother doing
+        explicit _stopPlugins and _removeSubviews. It's now the view's own responsibility
+        to do this in viewWillMoveToWindow:. Call _takeOwnershipOfWidget after attaching
+        the widget to the RenderPart.
+
+        * WebView.subproj/IFImageView.m: (-[IFImageView viewWillMoveToWindow:]): Added.
+        Break the reference cycle by stopping animated IFImageRenderer here instead of
+        waiting for dealloc.
+
+        * Plugins.subproj/IFPluginView.mm: (-[IFPluginView setWindow]): Fix a warning
+        by changing the printf format string to match the parameter type.
+
+        * Misc.subproj/WebKitDebug.h: Re-add the __format__ attribute, now that Radar
+        2920557 is fixed.
+
 2002-06-23  Darin Adler  <darin at apple.com>
 
         * WebCoreSupport.subproj/IFImageRenderer.m: (-[IFImageRenderer nextFrame:]):
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index d678928..0ed541e 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,47 @@
+2002-06-24  Darin Adler  <darin at apple.com>
+
+        Fix the last of the "leak the world" problems. The KHTMLView was leaking
+        in IFHTMLView.
+
+        * WebView.subproj/IFHTMLView.mm:
+        (-[IFHTMLView dealloc]): Call _reset instead of _stopPlugins, so we get rid
+        of the widget too.
+        (-[IFHTMLView viewWillMoveToWindow:]): Use _reset now instead of the old
+        _stopPlugins; also check that the window isn't already nil so we don't do a
+        reset as part of our first install.
+        (-[IFHTMLView provisionalDataSourceCommitted:]): Use the new widgetOwned
+        flag to tell if the widget should be deleted instead of deciding based on
+        whether the dataSource is the main document.
+
+        * WebView.subproj/IFHTMLViewPrivate.h: Add a widgetOwned boolean and a
+        private _takeOwnershipOfWidget method. Combine _resetWidget and _stopPlugins
+        into a single _reset call. Remove _removeSubviews.
+
+        * WebView.subproj/IFHTMLViewPrivate.mm:
+        (-[IFHTMLView _reset]): New name for the combination of _resetWidget and
+        _stopPlugins. Now it decides whether to delete the widget based on the
+        widget owned flag, so it is safe to call even for non-main-document views.
+        (-[IFHTMLView _takeOwnershipOfWidget]): Sets widgetOwned to NO.
+
+        * WebView.subproj/IFWebFrame.mm: (-[IFWebFrame reset]): Use _resetWidget
+        under its new name _reset.
+
+        * WebView.subproj/IFWebFramePrivate.mm:
+        (-[IFWebFrame _transitionProvisionalToCommitted]): Don't bother doing
+        explicit _stopPlugins and _removeSubviews. It's now the view's own responsibility
+        to do this in viewWillMoveToWindow:. Call _takeOwnershipOfWidget after attaching
+        the widget to the RenderPart.
+
+        * WebView.subproj/IFImageView.m: (-[IFImageView viewWillMoveToWindow:]): Added.
+        Break the reference cycle by stopping animated IFImageRenderer here instead of
+        waiting for dealloc.
+
+        * Plugins.subproj/IFPluginView.mm: (-[IFPluginView setWindow]): Fix a warning
+        by changing the printf format string to match the parameter type.
+
+        * Misc.subproj/WebKitDebug.h: Re-add the __format__ attribute, now that Radar
+        2920557 is fixed.
+
 2002-06-23  Darin Adler  <darin at apple.com>
 
         * WebCoreSupport.subproj/IFImageRenderer.m: (-[IFImageRenderer nextFrame:]):
diff --git a/WebKit/Misc.subproj/WebKitDebug.h b/WebKit/Misc.subproj/WebKitDebug.h
index eb84a02..16cc221 100644
--- a/WebKit/Misc.subproj/WebKitDebug.h
+++ b/WebKit/Misc.subproj/WebKitDebug.h
@@ -55,11 +55,7 @@ extern "C" {
 
 void WebKitSetLogLevel(int mask);
 unsigned int WebKitGetLogLevel(void);
-void WebKitLog(unsigned int level, const char *file, int line, const char *function, const char *format, ...)
-// FIXME: When Radar 2920557 is fixed, we can add this back and turn the -Wmissing-format-attribute
-// switch back on. PFE precompiled headers currently prevent this from working.
-//    __attribute__((__format__ (__printf__, 5, 6)))
-;
+void WebKitLog(unsigned int level, const char *file, int line, const char *function, const char *format, ...) __attribute__((__format__ (__printf__, 5, 6)));
 
 #ifdef __cplusplus
 }
diff --git a/WebKit/Plugins.subproj/IFPluginView.mm b/WebKit/Plugins.subproj/IFPluginView.mm
index 2ef9b73..0f51bb2 100644
--- a/WebKit/Plugins.subproj/IFPluginView.mm
+++ b/WebKit/Plugins.subproj/IFPluginView.mm
@@ -381,7 +381,7 @@ static char *newCString(NSString *string)
     window.type = NPWindowTypeWindow;
     
     npErr = NPP_SetWindow(instance, &window);
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_SetWindow: %d, port=0x%08lx\n", npErr, (int)nPort.port);
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_SetWindow: %d, port=0x%08x\n", npErr, (int)nPort.port);
 }
 
 -(void)start
diff --git a/WebKit/Plugins.subproj/WebPluginView.m b/WebKit/Plugins.subproj/WebPluginView.m
index 2ef9b73..0f51bb2 100644
--- a/WebKit/Plugins.subproj/WebPluginView.m
+++ b/WebKit/Plugins.subproj/WebPluginView.m
@@ -381,7 +381,7 @@ static char *newCString(NSString *string)
     window.type = NPWindowTypeWindow;
     
     npErr = NPP_SetWindow(instance, &window);
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_SetWindow: %d, port=0x%08lx\n", npErr, (int)nPort.port);
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_SetWindow: %d, port=0x%08x\n", npErr, (int)nPort.port);
 }
 
 -(void)start
diff --git a/WebKit/WebView.subproj/IFHTMLView.mm b/WebKit/WebView.subproj/IFHTMLView.mm
index fd3bd1f..92c6907 100644
--- a/WebKit/WebView.subproj/IFHTMLView.mm
+++ b/WebKit/WebView.subproj/IFHTMLView.mm
@@ -64,7 +64,7 @@
 
 - (void)dealloc 
 {
-    [self _stopPlugins];
+    [self _reset];
     [[NSNotificationCenter defaultCenter] removeObserver: self];
     [_private release];
     [super dealloc];
@@ -79,8 +79,8 @@
 
 - (void)viewWillMoveToWindow:(NSWindow *)window
 {
-    if (!window)
-        [self _stopPlugins];
+    if ([self window] && !window)
+        [self _reset];
     [super viewWillMoveToWindow:window];
 }
 
@@ -113,19 +113,16 @@
     
     data->provisionalWidget->setView (frameScrollView);
 
-    // Only delete the widget if we're the top level widget.  In other
-    // cases the widget is associated with a RenderFrame which will
-    // delete its widget.
-    if ([dataSource isMainDocument] && data->widget)
+    if (data->widgetOwned)
         delete data->widget;
 
     data->widget = data->provisionalWidget;
+    data->widgetOwned = YES;
     data->provisionalWidget = 0;
 }
 
 - (void)dataSourceUpdated: (IFWebDataSource *)dataSource
 {
-
 }
 
 - (void)reapplyStyles
diff --git a/WebKit/WebView.subproj/IFHTMLViewPrivate.h b/WebKit/WebView.subproj/IFHTMLViewPrivate.h
index e5c9992..77e4862 100644
--- a/WebKit/WebView.subproj/IFHTMLViewPrivate.h
+++ b/WebKit/WebView.subproj/IFHTMLViewPrivate.h
@@ -18,6 +18,7 @@ class KHTMLView;
 {
     IFWebController *controller;
     KHTMLView *widget;
+    BOOL widgetOwned;
     KHTMLView *provisionalWidget;
     BOOL isFlipped;
     BOOL needsLayout;
@@ -31,10 +32,11 @@ class KHTMLView;
 @end
 
 @interface IFHTMLView (IFPrivate)
+- (void)_reset;
+
 - (void)_setController: (IFWebController *)controller;
-- (void)_resetWidget;
+
 - (KHTMLView *)_widget;
 - (KHTMLView *)_provisionalWidget;
-- (void)_stopPlugins;
-- (void)_removeSubviews;
+- (void)_takeOwnershipOfWidget;
 @end
diff --git a/WebKit/WebView.subproj/IFHTMLViewPrivate.mm b/WebKit/WebView.subproj/IFHTMLViewPrivate.mm
index e4007d1..578d736 100644
--- a/WebKit/WebView.subproj/IFHTMLViewPrivate.mm
+++ b/WebKit/WebView.subproj/IFHTMLViewPrivate.mm
@@ -18,8 +18,6 @@
 
 - (void)dealloc
 {
-    // FIXME: Do we leak the provisional widget in the non-main frame cases?
-    
     [cursor release];
 
     [super dealloc];
@@ -29,15 +27,7 @@
 
 @implementation IFHTMLView (IFPrivate)
 
-- (void)_resetWidget
-{
-    delete _private->provisionalWidget;
-    _private->provisionalWidget = 0;
-    delete _private->widget;
-    _private->widget = 0;
-}
-
-- (void)_stopPlugins 
+- (void)_reset
 {
     NSArray *subviews = [[self subviews] copy];
 
@@ -52,14 +42,13 @@
         }
     }
     [subviews release];
-}
 
-- (void)_removeSubviews
-{
-    // Remove all the views.  They will be be re-added if this is a re-layout. 
-    NSArray *subviews = [[self subviews] copy];
-    [subviews makeObjectsPerformSelector:@selector(removeFromSuperviewWithoutNeedingDisplay)];
-    [subviews release];
+    delete _private->provisionalWidget;
+    _private->provisionalWidget = 0;
+    if (_private->widgetOwned)
+        delete _private->widget;
+    _private->widget = 0;
+    _private->widgetOwned = NO;
 }
 
 - (void)_setController: (IFWebController *)controller
@@ -78,4 +67,9 @@
     return _private->provisionalWidget;    
 }
 
+- (void)_takeOwnershipOfWidget
+{
+    _private->widgetOwned = NO;
+}
+
 @end
diff --git a/WebKit/WebView.subproj/IFImageView.m b/WebKit/WebView.subproj/IFImageView.m
index a848bcd..899e656 100644
--- a/WebKit/WebView.subproj/IFImageView.m
+++ b/WebKit/WebView.subproj/IFImageView.m
@@ -96,4 +96,12 @@
 }
 
 
+- (void)viewWillMoveToWindow:(NSWindow *)newWindow
+{
+    if (!newWindow)
+        [[representation image] stopAnimation];
+    [super viewWillMoveToWindow:newWindow];
+}
+
+
 @end
diff --git a/WebKit/WebView.subproj/IFWebFrame.mm b/WebKit/WebView.subproj/IFWebFrame.mm
index bdf2a80..ae986fd 100644
--- a/WebKit/WebView.subproj/IFWebFrame.mm
+++ b/WebKit/WebView.subproj/IFWebFrame.mm
@@ -211,8 +211,8 @@
 - (void)reset
 {
     [_private setDataSource: nil];
-    if([[[self webView] documentView] isKindOfClass: NSClassFromString(@"IFHTMLView")])
-        [[[self webView] documentView] _resetWidget];
+    if ([[self webView] isDocumentHTML])
+        [[[self webView] documentView] _reset];
     [_private setWebView: nil];
 }
 
diff --git a/WebKit/WebView.subproj/IFWebFramePrivate.mm b/WebKit/WebView.subproj/IFWebFramePrivate.mm
index d61ecd7..56780c3 100644
--- a/WebKit/WebView.subproj/IFWebFramePrivate.mm
+++ b/WebKit/WebView.subproj/IFWebFramePrivate.mm
@@ -219,15 +219,6 @@ static const char * const stateNames[6] = {
         {
             WEBKIT_ASSERT (documentView != nil);
 
-            if(isDocumentHTML){
-            
-                // Make sure any plugsin are shut down cleanly.
-                [documentView _stopPlugins];
-                
-                // Remove any widgets.
-                [documentView _removeSubviews];
-            }
-            
             // Set the committed data source on the frame.
             [self _setDataSource: _private->provisionalDataSource];
             
@@ -240,7 +231,8 @@ static const char * const stateNames[6] = {
             khtml::RenderPart *renderPartFrame = [self _renderFramePart];
             if (renderPartFrame && isDocumentHTML) {
                 // Setting the widget will delete the previous KHTMLView associated with the frame.
-                renderPartFrame->setWidget ([documentView _widget]);
+                renderPartFrame->setWidget([documentView _widget]);
+                [documentView _takeOwnershipOfWidget];
             }
            
             // Now that the provisional data source is committed, release it.
diff --git a/WebKit/WebView.subproj/WebFrame.m b/WebKit/WebView.subproj/WebFrame.m
index bdf2a80..ae986fd 100644
--- a/WebKit/WebView.subproj/WebFrame.m
+++ b/WebKit/WebView.subproj/WebFrame.m
@@ -211,8 +211,8 @@
 - (void)reset
 {
     [_private setDataSource: nil];
-    if([[[self webView] documentView] isKindOfClass: NSClassFromString(@"IFHTMLView")])
-        [[[self webView] documentView] _resetWidget];
+    if ([[self webView] isDocumentHTML])
+        [[[self webView] documentView] _reset];
     [_private setWebView: nil];
 }
 
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index d61ecd7..56780c3 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -219,15 +219,6 @@ static const char * const stateNames[6] = {
         {
             WEBKIT_ASSERT (documentView != nil);
 
-            if(isDocumentHTML){
-            
-                // Make sure any plugsin are shut down cleanly.
-                [documentView _stopPlugins];
-                
-                // Remove any widgets.
-                [documentView _removeSubviews];
-            }
-            
             // Set the committed data source on the frame.
             [self _setDataSource: _private->provisionalDataSource];
             
@@ -240,7 +231,8 @@ static const char * const stateNames[6] = {
             khtml::RenderPart *renderPartFrame = [self _renderFramePart];
             if (renderPartFrame && isDocumentHTML) {
                 // Setting the widget will delete the previous KHTMLView associated with the frame.
-                renderPartFrame->setWidget ([documentView _widget]);
+                renderPartFrame->setWidget([documentView _widget]);
+                [documentView _takeOwnershipOfWidget];
             }
            
             // Now that the provisional data source is committed, release it.
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index fd3bd1f..92c6907 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -64,7 +64,7 @@
 
 - (void)dealloc 
 {
-    [self _stopPlugins];
+    [self _reset];
     [[NSNotificationCenter defaultCenter] removeObserver: self];
     [_private release];
     [super dealloc];
@@ -79,8 +79,8 @@
 
 - (void)viewWillMoveToWindow:(NSWindow *)window
 {
-    if (!window)
-        [self _stopPlugins];
+    if ([self window] && !window)
+        [self _reset];
     [super viewWillMoveToWindow:window];
 }
 
@@ -113,19 +113,16 @@
     
     data->provisionalWidget->setView (frameScrollView);
 
-    // Only delete the widget if we're the top level widget.  In other
-    // cases the widget is associated with a RenderFrame which will
-    // delete its widget.
-    if ([dataSource isMainDocument] && data->widget)
+    if (data->widgetOwned)
         delete data->widget;
 
     data->widget = data->provisionalWidget;
+    data->widgetOwned = YES;
     data->provisionalWidget = 0;
 }
 
 - (void)dataSourceUpdated: (IFWebDataSource *)dataSource
 {
-
 }
 
 - (void)reapplyStyles
diff --git a/WebKit/WebView.subproj/WebHTMLViewPrivate.h b/WebKit/WebView.subproj/WebHTMLViewPrivate.h
index e5c9992..77e4862 100644
--- a/WebKit/WebView.subproj/WebHTMLViewPrivate.h
+++ b/WebKit/WebView.subproj/WebHTMLViewPrivate.h
@@ -18,6 +18,7 @@ class KHTMLView;
 {
     IFWebController *controller;
     KHTMLView *widget;
+    BOOL widgetOwned;
     KHTMLView *provisionalWidget;
     BOOL isFlipped;
     BOOL needsLayout;
@@ -31,10 +32,11 @@ class KHTMLView;
 @end
 
 @interface IFHTMLView (IFPrivate)
+- (void)_reset;
+
 - (void)_setController: (IFWebController *)controller;
-- (void)_resetWidget;
+
 - (KHTMLView *)_widget;
 - (KHTMLView *)_provisionalWidget;
-- (void)_stopPlugins;
-- (void)_removeSubviews;
+- (void)_takeOwnershipOfWidget;
 @end
diff --git a/WebKit/WebView.subproj/WebHTMLViewPrivate.m b/WebKit/WebView.subproj/WebHTMLViewPrivate.m
index e4007d1..578d736 100644
--- a/WebKit/WebView.subproj/WebHTMLViewPrivate.m
+++ b/WebKit/WebView.subproj/WebHTMLViewPrivate.m
@@ -18,8 +18,6 @@
 
 - (void)dealloc
 {
-    // FIXME: Do we leak the provisional widget in the non-main frame cases?
-    
     [cursor release];
 
     [super dealloc];
@@ -29,15 +27,7 @@
 
 @implementation IFHTMLView (IFPrivate)
 
-- (void)_resetWidget
-{
-    delete _private->provisionalWidget;
-    _private->provisionalWidget = 0;
-    delete _private->widget;
-    _private->widget = 0;
-}
-
-- (void)_stopPlugins 
+- (void)_reset
 {
     NSArray *subviews = [[self subviews] copy];
 
@@ -52,14 +42,13 @@
         }
     }
     [subviews release];
-}
 
-- (void)_removeSubviews
-{
-    // Remove all the views.  They will be be re-added if this is a re-layout. 
-    NSArray *subviews = [[self subviews] copy];
-    [subviews makeObjectsPerformSelector:@selector(removeFromSuperviewWithoutNeedingDisplay)];
-    [subviews release];
+    delete _private->provisionalWidget;
+    _private->provisionalWidget = 0;
+    if (_private->widgetOwned)
+        delete _private->widget;
+    _private->widget = 0;
+    _private->widgetOwned = NO;
 }
 
 - (void)_setController: (IFWebController *)controller
@@ -78,4 +67,9 @@
     return _private->provisionalWidget;    
 }
 
+- (void)_takeOwnershipOfWidget
+{
+    _private->widgetOwned = NO;
+}
+
 @end
diff --git a/WebKit/WebView.subproj/WebImageView.m b/WebKit/WebView.subproj/WebImageView.m
index a848bcd..899e656 100644
--- a/WebKit/WebView.subproj/WebImageView.m
+++ b/WebKit/WebView.subproj/WebImageView.m
@@ -96,4 +96,12 @@
 }
 
 
+- (void)viewWillMoveToWindow:(NSWindow *)newWindow
+{
+    if (!newWindow)
+        [[representation image] stopAnimation];
+    [super viewWillMoveToWindow:newWindow];
+}
+
+
 @end

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list