src/dbus/qdbusintegrator.cpp
changeset 37 758a864f9613
parent 33 3e2da88830cd
--- a/src/dbus/qdbusintegrator.cpp	Fri Sep 17 08:34:18 2010 +0300
+++ b/src/dbus/qdbusintegrator.cpp	Mon Oct 04 01:19:32 2010 +0300
@@ -618,7 +618,7 @@
             continue;
 
         // check type:
-        if (mm.methodType() != QMetaMethod::Slot)
+        if (mm.methodType() != QMetaMethod::Slot && mm.methodType() != QMetaMethod::Method)
             continue;
 
         // check name:
@@ -682,10 +682,17 @@
         if (isAsync && metaTypes.count() > i + 1)
             continue;
 
-        if (isScriptable && (flags & QDBusConnection::ExportScriptableSlots) == 0)
-            continue;           // not exported
-        if (!isScriptable && (flags & QDBusConnection::ExportNonScriptableSlots) == 0)
-            continue;           // not exported
+        if (mm.methodType() == QMetaMethod::Slot) {
+            if (isScriptable && (flags & QDBusConnection::ExportScriptableSlots) == 0)
+                continue;           // scriptable slots not exported
+            if (!isScriptable && (flags & QDBusConnection::ExportNonScriptableSlots) == 0)
+                continue;           // non-scriptable slots not exported
+        } else {
+            if (isScriptable && (flags & QDBusConnection::ExportScriptableInvokables) == 0)
+                continue;           // scriptable invokables not exported
+            if (!isScriptable && (flags & QDBusConnection::ExportNonScriptableInvokables) == 0)
+                continue;           // non-scriptable invokables not exported
+        }
 
         // if we got here, this slot matched
         return idx;
@@ -707,6 +714,9 @@
     if (metaTypes[n] == QDBusMetaTypeId::message)
         --n;
 
+    if (msg.arguments().count() < n)
+        return 0;               // too few arguments
+
     // check that types match
     for (int i = 0; i < n; ++i)
         if (metaTypes.at(i + 1) != msg.arguments().at(i).userType() &&
@@ -1379,7 +1389,8 @@
         return;                 // internal filters have already run or an error has been sent
 
     // try the object itself:
-    if (node.flags & (QDBusConnection::ExportScriptableSlots|QDBusConnection::ExportNonScriptableSlots)) {
+    if (node.flags & (QDBusConnection::ExportScriptableSlots|QDBusConnection::ExportNonScriptableSlots) ||
+        node.flags & (QDBusConnection::ExportScriptableInvokables|QDBusConnection::ExportNonScriptableInvokables)) {
         bool interfaceFound = true;
         if (!msg.interface().isEmpty())
             interfaceFound = qDBusInterfaceInObject(node.obj, msg.interface());