Title: [141805] trunk/Source/_javascript_Core
Revision
141805
Author
[email protected]
Date
2013-02-04 13:37:43 -0800 (Mon, 04 Feb 2013)

Log Message

Objective-C API: ObjCCallbackFunction should retain the target of its NSInvocation
https://bugs.webkit.org/show_bug.cgi?id=108843

Reviewed by Darin Adler.

Currently, ObjCCallbackFunction doesn't retain the target of its NSInvocation. It needs to do 
this to prevent crashes when trying to invoke a callback later on.

* API/ObjCCallbackFunction.mm:
(ObjCCallbackFunction::ObjCCallbackFunction):
(ObjCCallbackFunction::~ObjCCallbackFunction):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/ObjCCallbackFunction.mm (141804 => 141805)


--- trunk/Source/_javascript_Core/API/ObjCCallbackFunction.mm	2013-02-04 21:34:39 UTC (rev 141804)
+++ trunk/Source/_javascript_Core/API/ObjCCallbackFunction.mm	2013-02-04 21:37:43 UTC (rev 141805)
@@ -426,10 +426,14 @@
         , m_result(result)
     {
         ASSERT(type != CallbackInstanceMethod || instanceClass);
+        if (m_type != CallbackInstanceMethod)
+            [[m_invocation.get() target] retain];
     }
 
     ~ObjCCallbackFunction()
     {
+        if (m_type != CallbackInstanceMethod)
+            [[m_invocation.get() target] release];
         [m_instanceClass release];
     }
 

Modified: trunk/Source/_javascript_Core/ChangeLog (141804 => 141805)


--- trunk/Source/_javascript_Core/ChangeLog	2013-02-04 21:34:39 UTC (rev 141804)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-02-04 21:37:43 UTC (rev 141805)
@@ -1,3 +1,17 @@
+2013-02-04  Mark Hahnenberg  <[email protected]>
+
+        Objective-C API: ObjCCallbackFunction should retain the target of its NSInvocation
+        https://bugs.webkit.org/show_bug.cgi?id=108843
+
+        Reviewed by Darin Adler.
+
+        Currently, ObjCCallbackFunction doesn't retain the target of its NSInvocation. It needs to do 
+        this to prevent crashes when trying to invoke a callback later on.
+
+        * API/ObjCCallbackFunction.mm:
+        (ObjCCallbackFunction::ObjCCallbackFunction):
+        (ObjCCallbackFunction::~ObjCCallbackFunction):
+
 2013-02-04  Martin Robinson  <[email protected]>
 
         Fix GTK+ 'make dist' in preparation for the 1.11.5 release.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to