Title: [125276] trunk/Source/WebCore
Revision
125276
Author
[email protected]
Date
2012-08-10 06:40:33 -0700 (Fri, 10 Aug 2012)

Log Message

[Qt] Fix failing assertions when using JSC C API in QObject bridge
https://bugs.webkit.org/show_bug.cgi?id=93720

Reviewed by Kenneth Rohde Christiansen.

Avoid calling JSValueProtect and JSValueIsEqual with null JSValueRefs, as in debug
builds they trigger failing assertions about the arguments being non-null.

In these signal & slot connections the receiver can be null, when the signal is connected
just to a function, for example using obj.mySignal.connect(function() { .... }).

* bridge/qt/qt_runtime.cpp:
(JSC::Bindings::QtConnectionObject::QtConnectionObject):
(JSC::Bindings::QtConnectionObject::~QtConnectionObject):
(JSC::Bindings::QtConnectionObject::match):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (125275 => 125276)


--- trunk/Source/WebCore/ChangeLog	2012-08-10 13:37:46 UTC (rev 125275)
+++ trunk/Source/WebCore/ChangeLog	2012-08-10 13:40:33 UTC (rev 125276)
@@ -1,5 +1,23 @@
 2012-08-10  Simon Hausmann  <[email protected]>
 
+        [Qt] Fix failing assertions when using JSC C API in QObject bridge
+        https://bugs.webkit.org/show_bug.cgi?id=93720
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Avoid calling JSValueProtect and JSValueIsEqual with null JSValueRefs, as in debug
+        builds they trigger failing assertions about the arguments being non-null.
+
+        In these signal & slot connections the receiver can be null, when the signal is connected
+        just to a function, for example using obj.mySignal.connect(function() { .... }).
+
+        * bridge/qt/qt_runtime.cpp:
+        (JSC::Bindings::QtConnectionObject::QtConnectionObject):
+        (JSC::Bindings::QtConnectionObject::~QtConnectionObject):
+        (JSC::Bindings::QtConnectionObject::match):
+
+2012-08-10  Simon Hausmann  <[email protected]>
+
         [Qt] Remove QRegExp <> JS RegExp conversion
         https://bugs.webkit.org/show_bug.cgi?id=93716
 

Modified: trunk/Source/WebCore/bridge/qt/qt_runtime.cpp (125275 => 125276)


--- trunk/Source/WebCore/bridge/qt/qt_runtime.cpp	2012-08-10 13:37:46 UTC (rev 125275)
+++ trunk/Source/WebCore/bridge/qt/qt_runtime.cpp	2012-08-10 13:40:33 UTC (rev 125276)
@@ -1702,7 +1702,8 @@
     , m_receiver(receiver)
     , m_receiverFunction(receiverFunction)
 {
-    JSValueProtect(m_context, m_receiver);
+    if (m_receiver)
+        JSValueProtect(m_context, m_receiver);
     JSValueProtect(m_context, m_receiverFunction);
 }
 
@@ -1712,7 +1713,8 @@
     // which is its QObject parent.
     QtRuntimeConnectionMethod::connections.remove(m_originalSender, this);
 
-    JSValueUnprotect(m_context, m_receiver);
+    if (m_receiver)
+        JSValueUnprotect(m_context, m_receiver);
     JSValueUnprotect(m_context, m_receiverFunction);
 }
 
@@ -1839,7 +1841,7 @@
     if (sender != m_originalSender || signalIndex != m_signalIndex)
         return false;
     JSValueRef* ignoredException = 0;
-    const bool receiverMatch = (!receiver && !m_receiver) || JSValueIsEqual(context, receiver, m_receiver, ignoredException);
+    const bool receiverMatch = (!receiver && !m_receiver) || (receiver && m_receiver && JSValueIsEqual(context, receiver, m_receiver, ignoredException));
     return receiverMatch && JSValueIsEqual(context, receiverFunction, m_receiverFunction, ignoredException);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to