Title: [151270] trunk/Source/WebKit2
Revision
151270
Author
[email protected]
Date
2013-06-06 07:41:13 -0700 (Thu, 06 Jun 2013)

Log Message

[Gtk] Connection is leaking when WebProcess is terminated
https://bugs.webkit.org/show_bug.cgi?id=117293

Reviewed by Martin Robinson.

Connection is leaking because WorkQueue::SocketEventSource inherits from
WorkQueue::EventSource but when it is destroyed, the actual destructor running
is the one from base class; however, subclass contains a function binded from
Connection (m_closeFunction) and we need to do this extra cleanup, otherwise
WorkQueue will keep Connection alive. A better explanation of this fix is provided
on http://stackoverflow.com/questions/461203/when-to-use-virtual-destructors

A quick way to see the leak is to change WK2 test "ReloadPageAfterCrash" to terminate
WebProcess N times and add a printf on Connection destructor.

* Platform/gtk/WorkQueueGtk.cpp:
(WorkQueue::EventSource::~EventSource): Adds a virtual destructor to enable
the subclass to do its own cleanup.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (151269 => 151270)


--- trunk/Source/WebKit2/ChangeLog	2013-06-06 13:54:14 UTC (rev 151269)
+++ trunk/Source/WebKit2/ChangeLog	2013-06-06 14:41:13 UTC (rev 151270)
@@ -1,3 +1,24 @@
+2013-06-06  Rafael Brandao  <[email protected]>
+
+        [Gtk] Connection is leaking when WebProcess is terminated
+        https://bugs.webkit.org/show_bug.cgi?id=117293
+
+        Reviewed by Martin Robinson.
+
+        Connection is leaking because WorkQueue::SocketEventSource inherits from
+        WorkQueue::EventSource but when it is destroyed, the actual destructor running
+        is the one from base class; however, subclass contains a function binded from
+        Connection (m_closeFunction) and we need to do this extra cleanup, otherwise
+        WorkQueue will keep Connection alive. A better explanation of this fix is provided
+        on http://stackoverflow.com/questions/461203/when-to-use-virtual-destructors
+
+        A quick way to see the leak is to change WK2 test "ReloadPageAfterCrash" to terminate
+        WebProcess N times and add a printf on Connection destructor.
+
+        * Platform/gtk/WorkQueueGtk.cpp:
+        (WorkQueue::EventSource::~EventSource): Adds a virtual destructor to enable
+        the subclass to do its own cleanup.
+
 2013-06-06  Jae Hyun Park  <[email protected]>
 
         Coordinated Graphics : Refactor CoordinatedSurface to manage the lifecycle of GraphicsContext

Modified: trunk/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp (151269 => 151270)


--- trunk/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp	2013-06-06 13:54:14 UTC (rev 151269)
+++ trunk/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp	2013-06-06 14:41:13 UTC (rev 151270)
@@ -42,6 +42,8 @@
         ASSERT(workQueue);
     }
 
+    virtual ~EventSource() { }
+
     void performWork()
     {
         m_function();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to