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.
This commit is contained in:
Stuart Longland 2015-04-10 05:38:26 +10:00
parent fd4eaef364
commit 2622a482b4
1 changed files with 10 additions and 3 deletions

View File

@ -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);
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;
}