From 2622a482b4e05ac6dcff02d3cd5043742ae7ab56 Mon Sep 17 00:00:00 2001 From: Stuart Longland Date: Fri, 10 Apr 2015 05:38:26 +1000 Subject: [PATCH] QAmqpClient: Store the nameless exchange too. Since there will be probably many requests for that one. If we're passed in QString() instead of QString(""), we overwrite that with the latter to ensure the name field is never NULL. --- src/qamqpclient.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/qamqpclient.cpp b/src/qamqpclient.cpp index a0e5659..2626950 100644 --- a/src/qamqpclient.cpp +++ b/src/qamqpclient.cpp @@ -670,10 +670,17 @@ QAmqpExchange *QAmqpClient::createExchange(const QString &name, int channelNumbe connect(this, SIGNAL(disconnected()), exchange, SLOT(_q_disconnected())); exchange->d_func()->open(); - if (!name.isEmpty()) { + if (!name.isEmpty()) exchange->setName(name); - d->exchanges[name] = exchange; - } + else if (name.isNull()) + /* + * We don't want two copies of the default exchange, one referenced by + * QString() and the other by QString(""). QString() != QString("") So + * if it's null, overwrite with the empty string, since that's its + * official name. + */ + name = ""; + d->exchanges[name] = exchange; return exchange; }