[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:46:21 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 2de03ad42427c9af2e0aff7631a2d65da7c388e4
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jun 15 07:46:22 2004 +0000

            Reviewed by Maciej.
    
            - fixed some things for GC that Patrick missed, or that happened after the branch
    
            * kwq/DOM-CSS.mm:
            (-[DOMStyleSheet finalize]): Added.
            (-[DOMStyleSheetList finalize]): Added.
            (-[DOMCSSStyleSheet finalize]): Added.
            (-[DOMMediaList finalize]): Added.
            (-[DOMCSSRuleList finalize]): Added.
            (-[DOMCSSRule finalize]): Added.
            (-[DOMCSSStyleDeclaration finalize]): Added.
            (-[DOMCSSValue finalize]): Added.
            (-[DOMRGBColor finalize]): Added.
            (-[DOMRect finalize]): Added.
            (-[DOMCounter finalize]): Added.
            * kwq/DOM.mm:
            (-[DOMObject finalize]): Added.
            (-[DOMNode finalize]): Added.
            (-[DOMNamedNodeMap finalize]): Added.
            (-[DOMNodeList finalize]): Added.
            (-[DOMImplementation finalize]): Added.
            (-[DOMRange finalize]): Added.
            (-[DOMNodeFilter finalize]): Added.
            (-[DOMNodeIterator finalize]): Added.
            (-[DOMTreeWalker dealloc]): Removed unneeded nil check.
            (-[DOMTreeWalker finalize]): Added.
            * kwq/DOMHTML.mm:
            (-[DOMHTMLCollection finalize]): Added.
            (-[DOMHTMLOptionsCollection finalize]): Added.
            * kwq/KWQClipboard.mm:
            (KWQClipboard::KWQClipboard): Use KWQRetain instead of retain.
            (KWQClipboard::~KWQClipboard): Use KWQRelease instead of release.
            * kwq/KWQEditCommand.mm:
            (-[KWQEditCommand finalize]): Added.
            * kwq/KWQFont.mm:
            (QFont::~QFont): Use KWQRelease instead of release.
            * kwq/KWQKHTMLPart.mm:
            (KWQKHTMLPart::keyEvent): Use KWQRetain instead of retain, and KWQRelease instead of release.
            (KWQKHTMLPart::mouseDown): Use KWQRetain instead of retain, and KWQRelease instead of release.
            (KWQKHTMLPart::mouseDragged): Use KWQRetain instead of retain, and KWQRelease instead of release.
            (KWQKHTMLPart::mouseUp): Use KWQRetain instead of retain, and KWQRelease instead of release.
            (KWQKHTMLPart::mouseMoved): Use KWQRetain instead of retain, and KWQRelease instead of release.
            (KWQKHTMLPart::sendContextMenuEvent): Use KWQRetain instead of retain, and KWQRelease instead of release.
            * kwq/KWQPageState.mm:
            (-[KWQPageState finalize]): Added. Filed <rdar://problem/3694163> about the fact that this is not right.
            * kwq/KWQTimer.mm:
            (-[KWQSingleShotTimerTarget finalize]): Added.
            * kwq/WebCoreBridge.mm:
            (-[WebCoreBridge finalize]): Added. Filed <rdar://problem/3694165> about the fact that this is not right.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6847 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index cd8633b..b0671e0 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,56 @@
+2004-06-14  Darin Adler  <darin at apple.com>
+
+        Reviewed by Maciej.
+
+        - fixed some things for GC that Patrick missed, or that happened after the branch
+
+        * kwq/DOM-CSS.mm:
+        (-[DOMStyleSheet finalize]): Added.
+        (-[DOMStyleSheetList finalize]): Added.
+        (-[DOMCSSStyleSheet finalize]): Added.
+        (-[DOMMediaList finalize]): Added.
+        (-[DOMCSSRuleList finalize]): Added.
+        (-[DOMCSSRule finalize]): Added.
+        (-[DOMCSSStyleDeclaration finalize]): Added.
+        (-[DOMCSSValue finalize]): Added.
+        (-[DOMRGBColor finalize]): Added.
+        (-[DOMRect finalize]): Added.
+        (-[DOMCounter finalize]): Added.
+        * kwq/DOM.mm:
+        (-[DOMObject finalize]): Added.
+        (-[DOMNode finalize]): Added.
+        (-[DOMNamedNodeMap finalize]): Added.
+        (-[DOMNodeList finalize]): Added.
+        (-[DOMImplementation finalize]): Added.
+        (-[DOMRange finalize]): Added.
+        (-[DOMNodeFilter finalize]): Added.
+        (-[DOMNodeIterator finalize]): Added.
+        (-[DOMTreeWalker dealloc]): Removed unneeded nil check.
+        (-[DOMTreeWalker finalize]): Added.
+        * kwq/DOMHTML.mm:
+        (-[DOMHTMLCollection finalize]): Added.
+        (-[DOMHTMLOptionsCollection finalize]): Added.
+        * kwq/KWQClipboard.mm:
+        (KWQClipboard::KWQClipboard): Use KWQRetain instead of retain.
+        (KWQClipboard::~KWQClipboard): Use KWQRelease instead of release.
+        * kwq/KWQEditCommand.mm:
+        (-[KWQEditCommand finalize]): Added.
+        * kwq/KWQFont.mm:
+        (QFont::~QFont): Use KWQRelease instead of release.
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::keyEvent): Use KWQRetain instead of retain, and KWQRelease instead of release.
+        (KWQKHTMLPart::mouseDown): Use KWQRetain instead of retain, and KWQRelease instead of release.
+        (KWQKHTMLPart::mouseDragged): Use KWQRetain instead of retain, and KWQRelease instead of release.
+        (KWQKHTMLPart::mouseUp): Use KWQRetain instead of retain, and KWQRelease instead of release.
+        (KWQKHTMLPart::mouseMoved): Use KWQRetain instead of retain, and KWQRelease instead of release.
+        (KWQKHTMLPart::sendContextMenuEvent): Use KWQRetain instead of retain, and KWQRelease instead of release.
+        * kwq/KWQPageState.mm:
+        (-[KWQPageState finalize]): Added. Filed <rdar://problem/3694163> about the fact that this is not right.
+        * kwq/KWQTimer.mm:
+        (-[KWQSingleShotTimerTarget finalize]): Added.
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge finalize]): Added. Filed <rdar://problem/3694165> about the fact that this is not right.
+
 2004-06-15  David Hyatt  <hyatt at apple.com>
 
 	Initial work on text truncation.  Working top-down, I think I've made all the changes I will need to bidi.cpp
diff --git a/WebCore/kwq/DOM-CSS.mm b/WebCore/kwq/DOM-CSS.mm
index 9b8f33f..bc3bcf5 100644
--- a/WebCore/kwq/DOM-CSS.mm
+++ b/WebCore/kwq/DOM-CSS.mm
@@ -20,7 +20,7 @@
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #import "DOMCSS.h"
@@ -40,6 +40,7 @@
 
 #import "DOMInternal.h"
 #import "KWQAssertions.h"
+#import "KWQFoundationExtras.h"
 
 using DOM::AbstractViewImpl;
 using DOM::CounterImpl;
@@ -113,6 +114,14 @@ static inline int getPropertyID(NSString *string)
     [super dealloc];
 }
 
+- (void)finalize
+{
+    if (_internal) {
+        DOM_cast<StyleSheetImpl *>(_internal)->deref();
+    }
+    [super finalize];
+}
+
 - (StyleSheetImpl *)_DOMStyleSheetImpl
 {
     return DOM_cast<StyleSheetImpl *>(_internal);
@@ -199,6 +208,14 @@ static inline int getPropertyID(NSString *string)
     [super dealloc];
 }
 
+- (void)finalize
+{
+    if (_internal) {
+        DOM_cast<StyleSheetListImpl *>(_internal)->deref();
+    }
+    [super finalize];
+}
+
 - (StyleSheetListImpl *)_styleSheetListImpl
 {
     return DOM_cast<StyleSheetListImpl *>(_internal);
@@ -255,6 +272,14 @@ static inline int getPropertyID(NSString *string)
     [super dealloc];
 }
 
+- (void)finalize
+{
+    if (_internal) {
+        DOM_cast<CSSStyleSheetImpl *>(_internal)->deref();
+    }
+    [super finalize];
+}
+
 - (CSSStyleSheetImpl *)_CSSStyleSheetImpl
 {
     return DOM_cast<CSSStyleSheetImpl *>(_internal);
@@ -326,6 +351,14 @@ static inline int getPropertyID(NSString *string)
     [super dealloc];
 }
 
+- (void)finalize
+{
+    if (_internal) {
+        DOM_cast<MediaListImpl *>(_internal)->deref();
+    }
+    [super finalize];
+}
+
 - (MediaListImpl *)_mediaListImpl
 {
     return DOM_cast<MediaListImpl *>(_internal);
@@ -402,6 +435,14 @@ static inline int getPropertyID(NSString *string)
     [super dealloc];
 }
 
+- (void)finalize
+{
+    if (_internal) {
+        DOM_cast<CSSRuleListImpl *>(_internal)->deref();
+    }
+    [super finalize];
+}
+
 - (CSSRuleListImpl *)_ruleListImpl
 {
     return DOM_cast<CSSRuleListImpl *>(_internal);
@@ -458,6 +499,14 @@ static inline int getPropertyID(NSString *string)
     [super dealloc];
 }
 
+- (void)finalize
+{
+    if (_internal) {
+        DOM_cast<CSSRuleImpl *>(_internal)->deref();
+    }
+    [super finalize];
+}
+
 - (CSSRuleImpl *)_ruleImpl
 {
     return DOM_cast<CSSRuleImpl *>(_internal);
@@ -707,6 +756,14 @@ static inline int getPropertyID(NSString *string)
     [super dealloc];
 }
 
+- (void)finalize
+{
+    if (_internal) {
+        DOM_cast<CSSStyleDeclarationImpl *>(_internal)->deref();
+    }
+    [super finalize];
+}
+
 - (NSString *)cssText
 {
     return [self _styleDeclarationImpl]->cssText();
@@ -822,6 +879,14 @@ static inline int getPropertyID(NSString *string)
     [super dealloc];
 }
 
+- (void)finalize
+{
+    if (_internal) {
+        DOM_cast<CSSValueImpl *>(_internal)->deref();
+    }
+    [super finalize];
+}
+
 - (CSSValueImpl *)_valueImpl
 {
     return DOM_cast<CSSValueImpl *>(_internal);
@@ -1001,6 +1066,12 @@ void removeWrapperForRGB(QRgb value)
     [super dealloc];
 }
 
+- (void)finalize
+{
+    removeWrapperForRGB(reinterpret_cast<QRgb>(_internal));
+    [super finalize];
+}
+
 - (DOMCSSPrimitiveValue *)red
 {
     QRgb rgb = reinterpret_cast<QRgb>(_internal);
@@ -1076,6 +1147,14 @@ void removeWrapperForRGB(QRgb value)
     [super dealloc];
 }
 
+- (void)finalize
+{
+    if (_internal) {
+        DOM_cast<RectImpl *>(_internal)->deref();
+    }
+    [super finalize];
+}
+
 - (RectImpl *)_rectImpl
 {
     return DOM_cast<RectImpl *>(_internal);
@@ -1147,6 +1226,14 @@ void removeWrapperForRGB(QRgb value)
     [super dealloc];
 }
 
+- (void)finalize
+{
+    if (_internal) {
+        DOM_cast<CounterImpl *>(_internal)->deref();
+    }
+    [super finalize];
+}
+
 - (CounterImpl *)_counterImpl
 {
     return DOM_cast<CounterImpl *>(_internal);
diff --git a/WebCore/kwq/DOM.mm b/WebCore/kwq/DOM.mm
index a282fdf..3f2e21d 100644
--- a/WebCore/kwq/DOM.mm
+++ b/WebCore/kwq/DOM.mm
@@ -53,6 +53,7 @@
 #import "DOMHTML.h"
 #import "DOMInternal.h"
 #import "KWQAssertions.h"
+#import "KWQFoundationExtras.h"
 
 using DOM::Attr;
 using DOM::AttrImpl;
@@ -149,6 +150,14 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
     [super dealloc];
 }
 
+- (void)finalize
+{
+    if (_internal) {
+        removeDOMWrapper(_internal);
+    }
+    [super finalize];
+}
+
 - (id)copyWithZone:(NSZone *)zone
 {
     return [self retain];
@@ -178,6 +187,14 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
     [super dealloc];
 }
 
+- (void)finalize
+{
+    if (_internal) {
+        DOM_cast<NodeImpl *>(_internal)->deref();
+    }
+    [super finalize];
+}
+
 - (NSString *)nodeName
 {
     return [self _nodeImpl]->nodeName();
@@ -608,6 +625,14 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
     [super dealloc];
 }
 
+- (void)finalize
+{
+    if (_internal) {
+        DOM_cast<NamedNodeMapImpl *>(_internal)->deref();
+    }
+    [super finalize];
+}
+
 - (NamedNodeMapImpl *)_namedNodeMapImpl
 {
     return DOM_cast<NamedNodeMapImpl *>(_internal);
@@ -753,6 +778,14 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
     [super dealloc];
 }
 
+- (void)finalize
+{
+    if (_internal) {
+        DOM_cast<NodeListImpl *>(_internal)->deref();
+    }
+    [super finalize];
+}
+
 - (NodeListImpl *)_nodeListImpl
 {
     return DOM_cast<NodeListImpl *>(_internal);
@@ -811,6 +844,14 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
     [super dealloc];
 }
 
+- (void)finalize
+{
+    if (_internal) {
+        DOM_cast<DOMImplementationImpl *>(_internal)->deref();
+    }
+    [super finalize];
+}
+
 - (BOOL)hasFeature:(NSString *)feature :(NSString *)version
 {
     ASSERT(feature);
@@ -1656,6 +1697,14 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
     [super dealloc];
 }
 
+- (void)finalize
+{
+    if (_internal) {
+        DOM_cast<RangeImpl *>(_internal)->deref();
+    }
+    [super finalize];
+}
+
 - (DOMNode *)startContainer
 {
     int exceptionCode = 0;
@@ -1912,6 +1961,13 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
     [super dealloc];
 }
 
+- (void)finalize
+{
+    if (_internal)
+        DOM_cast<NodeFilterImpl *>(_internal)->deref();
+    [super finalize];
+}
+
 - (short)acceptNode:(DOMNode *)node
 {
     return [self _nodeFilterImpl]->acceptNode([node _nodeImpl]);
@@ -1941,8 +1997,7 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
 
 - (void)dealloc
 {
-    if (m_filter)
-        [m_filter release];
+    [m_filter release];
     if (_internal) {
         [self detach];
         DOM_cast<NodeIteratorImpl *>(_internal)->deref();
@@ -1950,6 +2005,15 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
     [super dealloc];
 }
 
+- (void)finalize
+{
+    if (_internal) {
+        [self detach];
+        DOM_cast<NodeIteratorImpl *>(_internal)->deref();
+    }
+    [super finalize];
+}
+
 - (DOMNode *)root
 {
     return [DOMNode _nodeWithImpl:[self _nodeIteratorImpl]->root()];
@@ -2040,11 +2104,20 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
 {
     if (m_filter)
         [m_filter release];
-    if (_internal)
+    if (_internal) {
         DOM_cast<TreeWalkerImpl *>(_internal)->deref();
+    }
     [super dealloc];
 }
 
+- (void)finalize
+{
+    if (_internal) {
+        DOM_cast<TreeWalkerImpl *>(_internal)->deref();
+    }
+    [super finalize];
+}
+
 - (DOMNode *)root
 {
     return [DOMNode _nodeWithImpl:[self _treeWalkerImpl]->root()];
diff --git a/WebCore/kwq/DOMHTML.mm b/WebCore/kwq/DOMHTML.mm
index b8049d9..3a14209 100644
--- a/WebCore/kwq/DOMHTML.mm
+++ b/WebCore/kwq/DOMHTML.mm
@@ -49,6 +49,7 @@
 #import "DOMInternal.h"
 #import "DOMHTMLInternal.h"
 #import "KWQAssertions.h"
+#import "KWQFoundationExtras.h"
 
 using DOM::Document;
 using DOM::DOMString;
@@ -159,6 +160,14 @@ using DOM::NodeImpl;
     [super dealloc];
 }
 
+- (void)finalize
+{
+    if (_internal) {
+        DOM_cast<HTMLCollectionImpl *>(_internal)->deref();
+    }
+    [super finalize];
+}
+
 - (HTMLCollectionImpl *)_collectionImpl
 {
     return DOM_cast<HTMLCollectionImpl *>(_internal);
@@ -219,6 +228,14 @@ using DOM::NodeImpl;
     [super dealloc];
 }
 
+- (void)finalize
+{
+    if (_internal) {
+        DOM_cast<HTMLOptionsCollectionImpl *>(_internal)->deref();
+    }
+    [super finalize];
+}
+
 - (id)_initWithOptionsCollectionImpl:(HTMLOptionsCollectionImpl *)impl
 {
     ASSERT(impl);
diff --git a/WebCore/kwq/KWQClipboard.mm b/WebCore/kwq/KWQClipboard.mm
index a9685a6..963b08f 100644
--- a/WebCore/kwq/KWQClipboard.mm
+++ b/WebCore/kwq/KWQClipboard.mm
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2004 Apple Computer, Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -25,6 +25,7 @@
 
 #import "KWQClipboard.h"
 #import "KWQAssertions.h"
+#import "KWQFoundationExtras.h"
 #import "KWQKHTMLPart.h"
 #import "KWQStringList.h"
 #import "WebCoreGraphicsBridge.h"
@@ -34,7 +35,7 @@
 using DOM::DOMString;
 
 KWQClipboard::KWQClipboard(bool forDragging, NSPasteboard *pasteboard, AccessPolicy policy, KWQKHTMLPart *part)
-  : m_pasteboard([pasteboard retain]), m_forDragging(forDragging),
+  : m_pasteboard(KWQRetain(pasteboard)), m_forDragging(forDragging),
     m_dragImageElement(0), m_policy(policy), m_dragStarted(false), m_part(part)
 {
     m_changeCount = [m_pasteboard changeCount];
@@ -42,7 +43,7 @@ KWQClipboard::KWQClipboard(bool forDragging, NSPasteboard *pasteboard, AccessPol
 
 KWQClipboard::~KWQClipboard()
 {
-    [m_pasteboard release];
+    KWQRelease(m_pasteboard);
 }
 
 bool KWQClipboard::isForDragging() const
diff --git a/WebCore/kwq/KWQEditCommand.mm b/WebCore/kwq/KWQEditCommand.mm
index fffbe24..ceee57c 100644
--- a/WebCore/kwq/KWQEditCommand.mm
+++ b/WebCore/kwq/KWQEditCommand.mm
@@ -48,6 +48,13 @@ using khtml::EditCommandImpl;
     [super dealloc];
 }
 
+- (void)finalize
+{
+    if (m_impl)
+        m_impl->deref();
+    [super dealloc];
+}
+
 + (KWQEditCommand *)commandWithEditCommandImpl:(EditCommandImpl *)impl
 {
     return [[[KWQEditCommand alloc] initWithEditCommandImpl:impl] autorelease];
diff --git a/WebCore/kwq/KWQFont.mm b/WebCore/kwq/KWQFont.mm
index 523baf3..4b13214 100644
--- a/WebCore/kwq/KWQFont.mm
+++ b/WebCore/kwq/KWQFont.mm
@@ -40,7 +40,7 @@ QFont::QFont()
 
 QFont::~QFont()
 {
-    [_NSFont release];
+    KWQRelease(_NSFont);
 }
 
 QFont::QFont(const QFont &other)
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index de53d7b..1acee1e 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -1646,7 +1646,7 @@ bool KWQKHTMLPart::keyEvent(NSEvent *event)
     }
     
     NSEvent *oldCurrentEvent = _currentEvent;
-    _currentEvent = [event retain];
+    _currentEvent = KWQRetain(event);
 
     QKeyEvent qEvent(event);
     bool result = !node->dispatchKeyEvent(&qEvent);
@@ -1663,7 +1663,7 @@ bool KWQKHTMLPart::keyEvent(NSEvent *event)
     }
 
     ASSERT(_currentEvent == event);
-    [event release];
+    KWQRelease(event);
     _currentEvent = oldCurrentEvent;
 
     return result;
@@ -2240,7 +2240,7 @@ void KWQKHTMLPart::mouseDown(NSEvent *event)
     _dragSrc = 0;
     
     NSEvent *oldCurrentEvent = _currentEvent;
-    _currentEvent = [event retain];
+    _currentEvent = KWQRetain(event);
     NSPoint loc = [event locationInWindow];
     d->m_view->viewportToContents((int)loc.x, (int)loc.y, _mouseDownX, _mouseDownY);
 
@@ -2249,7 +2249,7 @@ void KWQKHTMLPart::mouseDown(NSEvent *event)
     // responder, in this case we must be talking about the real first
     // responder, so we could just ask the bridge's window, instead of
     // the bridge. It's unclear which is better.
-    _firstResponderAtMouseDownTime = [[_bridge firstResponder] retain];
+    _firstResponderAtMouseDownTime = KWQRetain([_bridge firstResponder]);
 
     _mouseDownMayStartDrag = false;
     _mouseDownMayStartSelect = false;
@@ -2261,11 +2261,11 @@ void KWQKHTMLPart::mouseDown(NSEvent *event)
     v->viewportMousePressEvent(&kEvent);
     v->deref();
     
-    [_firstResponderAtMouseDownTime release];
+    KWQRelease(_firstResponderAtMouseDownTime);
     _firstResponderAtMouseDownTime = oldFirstResponderAtMouseDownTime;
 
     ASSERT(_currentEvent == event);
-    [event release];
+    KWQRelease(event);
     _currentEvent = oldCurrentEvent;
 
     KWQ_UNBLOCK_EXCEPTIONS;
@@ -2281,7 +2281,7 @@ void KWQKHTMLPart::mouseDragged(NSEvent *event)
     KWQ_BLOCK_EXCEPTIONS;
 
     NSEvent *oldCurrentEvent = _currentEvent;
-    _currentEvent = [event retain];
+    _currentEvent = KWQRetain(event);
 
     // Sending an event can result in the destruction of the view and part.
     // We ref so that happens after we return from the KHTMLView function.
@@ -2291,7 +2291,7 @@ void KWQKHTMLPart::mouseDragged(NSEvent *event)
     v->deref();
     
     ASSERT(_currentEvent == event);
-    [event release];
+    KWQRelease(event);
     _currentEvent = oldCurrentEvent;
 
     KWQ_UNBLOCK_EXCEPTIONS;
@@ -2307,7 +2307,7 @@ void KWQKHTMLPart::mouseUp(NSEvent *event)
     KWQ_BLOCK_EXCEPTIONS;
 
     NSEvent *oldCurrentEvent = _currentEvent;
-    _currentEvent = [event retain];
+    _currentEvent = KWQRetain(event);
 
     // Sending an event can result in the destruction of the view and part.
     // We ref so that happens after we return from the KHTMLView function.
@@ -2330,7 +2330,7 @@ void KWQKHTMLPart::mouseUp(NSEvent *event)
     v->deref();
     
     ASSERT(_currentEvent == event);
-    [event release];
+    KWQRelease(event);
     _currentEvent = oldCurrentEvent;
     
     _mouseDownView = nil;
@@ -2410,7 +2410,7 @@ void KWQKHTMLPart::mouseMoved(NSEvent *event)
     KWQ_BLOCK_EXCEPTIONS;
 
     NSEvent *oldCurrentEvent = _currentEvent;
-    _currentEvent = [event retain];
+    _currentEvent = KWQRetain(event);
     
     // Sending an event can result in the destruction of the view and part.
     // We ref so that happens after we return from the KHTMLView function.
@@ -2420,7 +2420,7 @@ void KWQKHTMLPart::mouseMoved(NSEvent *event)
     v->deref();
     
     ASSERT(_currentEvent == event);
-    [event release];
+    KWQRelease(event);
     _currentEvent = oldCurrentEvent;
 
     KWQ_UNBLOCK_EXCEPTIONS;
@@ -2451,7 +2451,7 @@ bool KWQKHTMLPart::sendContextMenuEvent(NSEvent *event)
     KWQ_BLOCK_EXCEPTIONS;
 
     NSEvent *oldCurrentEvent = _currentEvent;
-    _currentEvent = [event retain];
+    _currentEvent = KWQRetain(event);
     
     QMouseEvent qev(QEvent::MouseButtonPress, event);
 
@@ -2469,7 +2469,7 @@ bool KWQKHTMLPart::sendContextMenuEvent(NSEvent *event)
     v->deref();
 
     ASSERT(_currentEvent == event);
-    [event release];
+    KWQRelease(event);
     _currentEvent = oldCurrentEvent;
 
     return swallowEvent;
diff --git a/WebCore/kwq/KWQPageState.mm b/WebCore/kwq/KWQPageState.mm
index 62f8d18..c6a4521 100644
--- a/WebCore/kwq/KWQPageState.mm
+++ b/WebCore/kwq/KWQPageState.mm
@@ -32,6 +32,7 @@
 #import "kjs_window.h"
 
 #import "KWQAssertions.h"
+#import "KWQFoundationExtras.h"
 #import "KWQKHTMLPart.h"
 
 using DOM::DocumentImpl;
@@ -136,6 +137,37 @@ using KJS::SavedBuiltins;
     [super dealloc];
 }
 
+- (void)finalize
+{
+    // FIXME: This work really should not be done at deallocation time.
+    // We need to do it at some well-defined time instead.
+
+    if (document) {
+        ASSERT(document->inPageCache());
+        ASSERT(document->view());
+
+        KHTMLView *view = document->view();
+
+        KWQKHTMLPart::clearTimers(view);
+
+        bool detached = document->renderer() == 0;
+        document->setInPageCache(NO);
+        if (detached) {
+            document->detach();
+        }
+        document->deref();
+        
+        if (view) {
+            view->clearPart();
+            view->deref();
+        }
+    }
+
+    [self clear];
+
+    [super finalize];
+}
+
 - (DocumentImpl *)document
 {
     return document;
diff --git a/WebCore/kwq/KWQTimer.mm b/WebCore/kwq/KWQTimer.mm
index 1c828f3..e164940 100644
--- a/WebCore/kwq/KWQTimer.mm
+++ b/WebCore/kwq/KWQTimer.mm
@@ -79,6 +79,12 @@
     [super dealloc];
 }
 
+- (void)finalize
+{
+    delete slot;
+    [super finalize];
+}
+
 - (void)timerFired:(id)userInfo
 {
     slot->call();
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index f4c8354..ef272f7 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -63,6 +63,7 @@
 #import "KWQDOMNode.h"
 #import "KWQEditCommand.h"
 #import "KWQFont.h"
+#import "KWQFoundationExtras.h"
 #import "KWQFrame.h"
 #import "KWQKHTMLPart.h"
 #import "KWQLoader.h"
@@ -229,6 +230,22 @@ static bool initializedKJS = FALSE;
     [super dealloc];
 }
 
+- (void)finalize
+{
+    // FIXME: This work really should not be done at deallocation time.
+    // We need to do it at some well-defined time instead.
+
+    [self removeFromFrame];
+    
+    if (_renderPart) {
+        _renderPart->deref(_renderPartArena);
+    }
+    _part->setBridge(nil);
+    _part->deref();
+        
+    [super finalize];
+}
+
 - (KWQKHTMLPart *)part
 {
     return _part;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list