<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[23937] trunk/WebKit</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/23937">23937</a></dd>
<dt>Author</dt> <dd>darin</dd>
<dt>Date</dt> <dd>2007-07-02 16:30:13 -0700 (Mon, 02 Jul 2007)</dd>
</dl>

<h3>Log Message</h3>
<pre>        Reviewed by Kevin Decker and Tim Hatcher.

        - fix &lt;rdar://problem/5307880&gt; some classes need finalize methods
          because of non-trivial work done in dealloc methods

        * DefaultDelegates/WebScriptDebugServer.m:
        (-[WebScriptDebugServer dealloc]): Added a comment about how this probably won't
        work under GC.
        * WebInspector/WebNodeHighlight.m:
        (-[WebNodeHighlight dealloc]): Ditto.

        * WebView/WebDataSource.mm:
        (+[WebDataSourcePrivate initialize]): Added. Makes finalize run on main thread.
        (-[WebDataSourcePrivate finalize]): Added. Calls deref on the document loader.
        * WebView/WebHTMLView.mm:
        (+[WebHTMLViewPrivate initialize]): Added. Makes finalize run on main thread.
        (-[WebHTMLViewPrivate finalize]): Added. Calls deref on promisedDragTIFFDataSource.

        * WebKit.xcodeproj/project.pbxproj: Let Xcode be Xcode.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebKitChangeLog">trunk/WebKit/ChangeLog</a></li>
<li><a href="#trunkWebKitDefaultDelegatesWebScriptDebugServerm">trunk/WebKit/DefaultDelegates/WebScriptDebugServer.m</a></li>
<li><a href="#trunkWebKitWebInspectorWebNodeHighlightm">trunk/WebKit/WebInspector/WebNodeHighlight.m</a></li>
<li><a href="#trunkWebKitWebKitxcodeprojprojectpbxproj">trunk/WebKit/WebKit.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkWebKitWebViewWebDataSourcemm">trunk/WebKit/WebView/WebDataSource.mm</a></li>
<li><a href="#trunkWebKitWebViewWebHTMLViewmm">trunk/WebKit/WebView/WebHTMLView.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/ChangeLog (23936 => 23937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/ChangeLog        2007-07-02 23:29:41 UTC (rev 23936)
+++ trunk/WebKit/ChangeLog        2007-07-02 23:30:13 UTC (rev 23937)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2007-07-02  Darin Adler  &lt;darin@apple.com&gt;
+
+        Reviewed by Kevin Decker and Tim Hatcher.
+
+        - fix &lt;rdar://problem/5307880&gt; some classes need finalize methods
+          because of non-trivial work done in dealloc methods
+
+        * DefaultDelegates/WebScriptDebugServer.m:
+        (-[WebScriptDebugServer dealloc]): Added a comment about how this probably won't
+        work under GC.
+        * WebInspector/WebNodeHighlight.m:
+        (-[WebNodeHighlight dealloc]): Ditto.
+
+        * WebView/WebDataSource.mm:
+        (+[WebDataSourcePrivate initialize]): Added. Makes finalize run on main thread.
+        (-[WebDataSourcePrivate finalize]): Added. Calls deref on the document loader.
+        * WebView/WebHTMLView.mm:
+        (+[WebHTMLViewPrivate initialize]): Added. Makes finalize run on main thread.
+        (-[WebHTMLViewPrivate finalize]): Added. Calls deref on promisedDragTIFFDataSource.
+
+        * WebKit.xcodeproj/project.pbxproj: Let Xcode be Xcode.
+
</ins><span class="cx"> 2007-07-02  Oliver Hunt  &lt;oliver@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Justin.
</span></span></pre></div>
<a id="trunkWebKitDefaultDelegatesWebScriptDebugServerm"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/DefaultDelegates/WebScriptDebugServer.m (23936 => 23937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/DefaultDelegates/WebScriptDebugServer.m        2007-07-02 23:29:41 UTC (rev 23936)
+++ trunk/WebKit/DefaultDelegates/WebScriptDebugServer.m        2007-07-02 23:30:13 UTC (rev 23937)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
</del><ins>+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -90,6 +90,8 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)dealloc
</span><span class="cx"> {
</span><ins>+    // FIXME: Bad to do all this work in dealloc. What about under GC?
+
</ins><span class="cx">     ASSERT(listenerCount &gt;= [listeners count]);
</span><span class="cx">     listenerCount -= [listeners count];
</span><span class="cx">     if (!listenerCount)
</span></span></pre></div>
<a id="trunkWebKitWebInspectorWebNodeHighlightm"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/WebInspector/WebNodeHighlight.m (23936 => 23937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/WebInspector/WebNodeHighlight.m        2007-07-02 23:29:41 UTC (rev 23936)
+++ trunk/WebKit/WebInspector/WebNodeHighlight.m        2007-07-02 23:30:13 UTC (rev 23937)
</span><span class="lines">@@ -93,6 +93,8 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)dealloc
</span><span class="cx"> {
</span><ins>+    // FIXME: Bad to do all this work in dealloc. What about under GC?
+
</ins><span class="cx">     [self detachHighlight];
</span><span class="cx"> 
</span><span class="cx">     ASSERT(!_highlightWindow);
</span></span></pre></div>
<a id="trunkWebKitWebKitxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/WebKit.xcodeproj/project.pbxproj (23936 => 23937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/WebKit.xcodeproj/project.pbxproj        2007-07-02 23:29:41 UTC (rev 23936)
+++ trunk/WebKit/WebKit.xcodeproj/project.pbxproj        2007-07-02 23:30:13 UTC (rev 23937)
</span><span class="lines">@@ -1317,6 +1317,7 @@
</span><span class="cx">                 0867D690FE84028FC02AAC07 /* Project object */ = {
</span><span class="cx">                         isa = PBXProject;
</span><span class="cx">                         buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject &quot;WebKit&quot; */;
</span><ins>+                        compatibilityVersion = &quot;Xcode 2.4&quot;;
</ins><span class="cx">                         hasScannedForEncodings = 1;
</span><span class="cx">                         knownRegions = (
</span><span class="cx">                                 English,
</span><span class="lines">@@ -1330,6 +1331,7 @@
</span><span class="cx">                         mainGroup = 0867D691FE84028FC02AAC07 /* WebKit */;
</span><span class="cx">                         productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
</span><span class="cx">                         projectDirPath = &quot;&quot;;
</span><ins>+                        projectRoot = &quot;&quot;;
</ins><span class="cx">                         targets = (
</span><span class="cx">                                 9398100A0824BF01008DF038 /* WebKit */,
</span><span class="cx">                         );
</span></span></pre></div>
<a id="trunkWebKitWebViewWebDataSourcemm"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/WebView/WebDataSource.mm (23936 => 23937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/WebView/WebDataSource.mm        2007-07-02 23:29:41 UTC (rev 23936)
+++ trunk/WebKit/WebView/WebDataSource.mm        2007-07-02 23:30:13 UTC (rev 23937)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
</del><ins>+ * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -54,6 +54,7 @@
</span><span class="cx"> #import &lt;WebCore/MimeTypeRegistry.h&gt;
</span><span class="cx"> #import &lt;WebCore/ResourceRequest.h&gt;
</span><span class="cx"> #import &lt;WebCore/SharedBuffer.h&gt;
</span><ins>+#import &lt;WebCore/WebCoreObjCExtras.h&gt;
</ins><span class="cx"> #import &lt;WebKit/DOMHTML.h&gt;
</span><span class="cx"> #import &lt;WebKit/DOMPrivate.h&gt;
</span><span class="cx"> #import &lt;WebKitSystemInterface.h&gt;
</span><span class="lines">@@ -76,6 +77,13 @@
</span><span class="cx"> 
</span><span class="cx"> @implementation WebDataSourcePrivate 
</span><span class="cx"> 
</span><ins>+#ifndef BUILDING_ON_TIGER
++ (void)initialize
+{
+    WebCoreObjCFinalizeOnMainThread(self);
+}
+#endif
+
</ins><span class="cx"> - (void)dealloc
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!loader-&gt;isLoading());
</span><span class="lines">@@ -88,6 +96,15 @@
</span><span class="cx">     [super dealloc];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)finalize
+{
+    ASSERT(!loader-&gt;isLoading());
+
+    loader-&gt;deref();
+
+    [super finalize];
+}
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> @interface WebDataSource (WebFileInternal)
</span></span></pre></div>
<a id="trunkWebKitWebViewWebHTMLViewmm"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/WebView/WebHTMLView.mm (23936 => 23937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/WebView/WebHTMLView.mm        2007-07-02 23:29:41 UTC (rev 23936)
+++ trunk/WebKit/WebView/WebHTMLView.mm        2007-07-02 23:30:13 UTC (rev 23937)
</span><span class="lines">@@ -308,6 +308,13 @@
</span><span class="cx"> 
</span><span class="cx"> @implementation WebHTMLViewPrivate
</span><span class="cx"> 
</span><ins>+#ifndef BUILDING_ON_TIGER
++ (void)initialize
+{
+    WebCoreObjCFinalizeOnMainThread(self);
+}
+#endif
+
</ins><span class="cx"> - (void)dealloc
</span><span class="cx"> {
</span><span class="cx">     ASSERT(autoscrollTimer == nil);
</span><span class="lines">@@ -326,6 +333,16 @@
</span><span class="cx">     [super dealloc];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)finalize
+{
+    ASSERT_MAIN_THREAD();
+
+    if (promisedDragTIFFDataSource)
+        promisedDragTIFFDataSource-&gt;deref(promisedDataClient());
+
+    [super finalize];
+}
+
</ins><span class="cx"> - (void)clear
</span><span class="cx"> {
</span><span class="cx">     [mouseDownEvent release];
</span></span></pre>
</div>
</div>

</body>
</html>