[WK2] [GTK] Destructor not invoked in EditorClientFrameDestructionObserver
authorsergio@webkit.org <sergio@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Feb 2012 10:19:42 +0000 (10:19 +0000)
committersergio@webkit.org <sergio@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Feb 2012 10:19:42 +0000 (10:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=79466

Reviewed by Philippe Normand.

Explicitly cast the observer before deleting it instead of just
deleting a generic pointer. We must to that in order to get the
destructor of the object properly called.

* WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
(WebKit::EditorClientFrameDestructionObserver::destroyOnClosureFinalization):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108760 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp

index 26efb40..b714096 100644 (file)
@@ -1,3 +1,17 @@
+2012-02-24  Sergio Villar Senin  <svillar@igalia.com>
+
+        [WK2] [GTK] Destructor not invoked in EditorClientFrameDestructionObserver
+        https://bugs.webkit.org/show_bug.cgi?id=79466
+
+        Reviewed by Philippe Normand.
+
+        Explicitly cast the observer before deleting it instead of just
+        deleting a generic pointer. We must to that in order to get the
+        destructor of the object properly called.
+
+        * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
+        (WebKit::EditorClientFrameDestructionObserver::destroyOnClosureFinalization):
+
 2012-02-23  Andy Estes  <aestes@apple.com>
 
         Rename [setS|s]uppressIncrementalRendering to [setS|s]uppressesIncrementalRendering and make it WebPreferences API.
index 62622a6..9f34530 100644 (file)
@@ -148,7 +148,13 @@ public:
 private:
     GClosure* m_closure;
 
-    static void destroyOnClosureFinalization(gpointer data, GClosure* closure) { delete data; }
+    static void destroyOnClosureFinalization(gpointer data, GClosure* closure)
+    {
+        // Calling delete void* will free the memory but won't invoke
+        // the destructor, something that is a must for us.
+        EditorClientFrameDestructionObserver* observer = static_cast<EditorClientFrameDestructionObserver*>(data);
+        delete observer;
+    }
 };
 
 static Frame* frameSettingClipboard;