[webkit-reviews] review granted: [Bug 14348] Messing up the inspector by dragging an URL into it : [Attachment 19407] revised patch round 2

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Feb 27 14:36:55 PST 2008


Adam Roben (aroben) <aroben at apple.com> has granted Matt Lilek
<webkit at mattlilek.com>'s request for review:
Bug 14348: Messing up the inspector by dragging an URL into it
http://bugs.webkit.org/show_bug.cgi?id=14348

Attachment 19407: revised patch round 2
http://bugs.webkit.org/attachment.cgi?id=19407&action=edit

------- Additional Comments from Adam Roben (aroben) <aroben at apple.com>
+    if
(FAILED(m_webView->setUIDelegate(WebInspectorDelegate::createInstance())))
+	 return 0;

I think this is now leaking the delegate. On Windows, WebView retains its
delegates (this doesn't match the Mac model, and we may change it someday). You
should be able to fix the leak by doing this:

m_webView->setUIDelegate(COMPtr<WebInspectorDelegate>(AdoptCOM,
WebInspectorDelegate::createInstance()).get())

+WebInspectorDelegate::WebInspectorDelegate()
+    :m_refCount(1)
+{
+}
+
+WebInspectorDelegate* WebInspectorDelegate::createInstance()
+{
+    WebInspectorDelegate* instance = new WebInspectorDelegate();
+    return instance;
+}

Normally our COM classes start out with a refcount of 0 and then we call AddRef
inside the createInstance method.

You can also just say "new WebInspectorDelegate" without the parentheses.

r=me if you fix the issues above.


More information about the webkit-reviews mailing list