Title: [105732] trunk/Source/WebKit2
Revision
105732
Author
[email protected]
Date
2012-01-24 05:30:53 -0800 (Tue, 24 Jan 2012)

Log Message

[Qt][WK2] QtWebIconDatabaseClient leaves a dangling pointer on WebIconDatabase after its destruction
https://bugs.webkit.org/show_bug.cgi?id=76399

Patch by Rafael Brandao <[email protected]> on 2012-01-24
Reviewed by Simon Hausmann.

Due a circular dependency between WebContext and WebProcessProxy, WebContext it not
being destroyed, neither WebIconDatabase. As QtWebIconDatabaseClient's life time is the same
as QtWebContext and this one is being destroyed, the remaining reference to our client
on WebIconDatabase should be cleaned upon its destruction.

* UIProcess/qt/QtWebIconDatabaseClient.cpp:
(QtWebIconDatabaseClient::QtWebIconDatabaseClient):
(QtWebIconDatabaseClient::~QtWebIconDatabaseClient): Clear client pointer on WebIconDatabase.
* UIProcess/qt/QtWebIconDatabaseClient.h: Make this client hold a reference to WebIconDatabase.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (105731 => 105732)


--- trunk/Source/WebKit2/ChangeLog	2012-01-24 13:28:08 UTC (rev 105731)
+++ trunk/Source/WebKit2/ChangeLog	2012-01-24 13:30:53 UTC (rev 105732)
@@ -1,3 +1,20 @@
+2012-01-24  Rafael Brandao  <[email protected]>
+
+        [Qt][WK2] QtWebIconDatabaseClient leaves a dangling pointer on WebIconDatabase after its destruction
+        https://bugs.webkit.org/show_bug.cgi?id=76399
+
+        Reviewed by Simon Hausmann.
+
+        Due a circular dependency between WebContext and WebProcessProxy, WebContext it not
+        being destroyed, neither WebIconDatabase. As QtWebIconDatabaseClient's life time is the same
+        as QtWebContext and this one is being destroyed, the remaining reference to our client
+        on WebIconDatabase should be cleaned upon its destruction.
+
+        * UIProcess/qt/QtWebIconDatabaseClient.cpp:
+        (QtWebIconDatabaseClient::QtWebIconDatabaseClient):
+        (QtWebIconDatabaseClient::~QtWebIconDatabaseClient): Clear client pointer on WebIconDatabase.
+        * UIProcess/qt/QtWebIconDatabaseClient.h: Make this client hold a reference to WebIconDatabase.
+
 2012-01-24  Zeno Albisser  <[email protected]>
 
         [Qt][WK2] Add test for application URL schemes.

Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp (105731 => 105732)


--- trunk/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp	2012-01-24 13:28:08 UTC (rev 105731)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp	2012-01-24 13:30:53 UTC (rev 105732)
@@ -53,11 +53,12 @@
     iconDatabaseClient.version = kWKIconDatabaseClientCurrentVersion;
     iconDatabaseClient.clientInfo = this;
     iconDatabaseClient.didChangeIconForPageURL = didChangeIconForPageURL;
-    WKIconDatabaseSetIconDatabaseClient(toAPI(m_iconDatabase), &iconDatabaseClient);
+    WKIconDatabaseSetIconDatabaseClient(toAPI(m_iconDatabase.get()), &iconDatabaseClient);
 }
 
 QtWebIconDatabaseClient::~QtWebIconDatabaseClient()
 {
+    WKIconDatabaseSetIconDatabaseClient(toAPI(m_iconDatabase.get()), 0);
 }
 
 void QtWebIconDatabaseClient::didChangeIconForPageURL(WKIconDatabaseRef iconDatabase, WKURLRef pageURL, const void* clientInfo)

Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h (105731 => 105732)


--- trunk/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h	2012-01-24 13:28:08 UTC (rev 105731)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h	2012-01-24 13:30:53 UTC (rev 105732)
@@ -58,7 +58,7 @@
     unsigned iconURLHashForPageURL(const String&);
     static void didChangeIconForPageURL(WKIconDatabaseRef, WKURLRef pageURL, const void* clientInfo);
     uint64_t m_contextId;
-    WebKit::WebIconDatabase* m_iconDatabase;
+    RefPtr<WebKit::WebIconDatabase> m_iconDatabase;
     Mutex m_imageLock;
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to