forked from qt-creator/qt-creator
Fixed cmake signal handling in server-mode
Task-number: QTCREATORBUG-17319 Change-Id: I25673a32142a691dff2444be8981d747f10e18c5 Reviewed-by: Florian Apolloner <florian@apolloner.eu> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
committed by
Tobias Hunger
parent
7c07774a04
commit
4c22f3a76c
@@ -69,6 +69,15 @@ QString socketName(const Utils::FileName &buildDirectory)
|
||||
return buildDirectory.toString() + "/socket";
|
||||
}
|
||||
|
||||
bool isValid(const QVariant &v)
|
||||
{
|
||||
if (v.isNull())
|
||||
return false;
|
||||
if (v.type() == QVariant::String) // Workaround signals sending an empty string cookie
|
||||
return !v.toString().isEmpty();
|
||||
return true;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// ServerMode:
|
||||
// --------------------------------------------------------------------
|
||||
@@ -419,7 +428,7 @@ void ServerMode::parseJson(const QVariantMap &data)
|
||||
}
|
||||
if (type == "signal") {
|
||||
const QString replyTo = data.value(IN_REPLY_TO_KEY).toString();
|
||||
const QVariant cookie = data.value(COOKIE_KEY);
|
||||
const QString cookie = data.value(COOKIE_KEY).toString();
|
||||
const QString name = data.value(NAME_KEY).toString();
|
||||
qCInfo(cmakeServerMode) << "Got \"signal\" message." << name << replyTo << "(" << cookie << ")";
|
||||
|
||||
@@ -427,7 +436,7 @@ void ServerMode::parseJson(const QVariantMap &data)
|
||||
reportError(tr("Received a signal without a name."));
|
||||
return;
|
||||
}
|
||||
if (!replyTo.isEmpty() || cookie.isValid()) {
|
||||
if (!replyTo.isEmpty() || isValid(cookie)) {
|
||||
reportError(tr("Received a signal in reply to a request."));
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user