fix for registration of methods with typedef

This commit is contained in:
Stephen Birarda 2015-07-14 16:46:17 -07:00
parent b1650c0d8c
commit 15ca129005
2 changed files with 9 additions and 5 deletions

View file

@ -282,7 +282,7 @@ void DomainServer::setupNodeListAndAssignments(const QUuid& sessionUUID) {
// register as the packet receiver for the types we want
PacketReceiver& packetReceiver = nodeList->getPacketReceiver();
packetReceiver.registerListener(PacketType::RequestAssignment, this, "processRequestAssignmentPacket");
packetReceiver.registerListener(PacketType::DomainConnectRequest, this, "processConnectRequestPackets");
packetReceiver.registerListener(PacketType::DomainConnectRequest, this, "processConnectRequestPacket");
packetReceiver.registerListener(PacketType::DomainListRequest, this, "processListRequestPacket");
packetReceiver.registerListener(PacketType::DomainServerPathQuery, this, "processPathQueryPacket");
packetReceiver.registerListener(PacketType::NodeJsonStats, this, "processNodeJSONStatsPacket");

View file

@ -75,11 +75,13 @@ QMetaMethod PacketReceiver::matchingMethodForListener(PacketType::Value type, QO
QSet<QString> possibleSignatures { QString("%1(%2)").arg(slot).arg(NON_SOURCED_PACKET_LISTENER_PARAMETERS) };
if (!NON_SOURCED_PACKETS.contains(type)) {
const QString SOURCED_PACKET_LISTENER_PARAMETERS = "QSharedPointer<NLPacket>,QSharedPointer<Node>";
static const QString SOURCED_PACKET_LISTENER_PARAMETERS = "QSharedPointer<NLPacket>,QSharedPointer<Node>";
static const QString TYPEDEF_SOURCED_PACKET_LISTENER_PARAMETERS = "QSharedPointer<NLPacket>,SharedNodePointer";
// a sourced packet must take the shared pointer to the packet but optionally could include
// a shared pointer to the node
possibleSignatures << QString("%1(%2)").arg(slot).arg(TYPEDEF_SOURCED_PACKET_LISTENER_PARAMETERS);
possibleSignatures << QString("%1(%2)").arg(slot).arg(SOURCED_PACKET_LISTENER_PARAMETERS);
}
@ -88,11 +90,13 @@ QMetaMethod PacketReceiver::matchingMethodForListener(PacketType::Value type, QO
foreach(const QString& signature, possibleSignatures) {
QByteArray normalizedSlot =
QMetaObject::normalizedSignature(signature.toStdString().c_str());
// does the constructed normalized method exist?
methodIndex = object->metaObject()->indexOfSlot(normalizedSlot.toStdString().c_str());
break;
if (methodIndex >= 0) {
break;
}
}
if (methodIndex < 0) {
@ -100,7 +104,7 @@ QMetaMethod PacketReceiver::matchingMethodForListener(PacketType::Value type, QO
<< possibleSignatures.toList() << "- but such a method was not found.";
}
Q_ASSERT(methodIndex >= 0);
assert(methodIndex >= 0);
// return the converted QMetaMethod
if (methodIndex >= 0) {