QDBusError: don't refer to a QT_NAMESPACE'ed get() as ::get()

This code predates the public history. I don't know exactly how this
worked before, but I guess it's because the QT_USE_NAMESPACE in our
headers.

If there's _any_ get() function at the global scope, then name lookup
stops there and considers _only_ that function. And if that happens to
have a compatible signature, good night.

Use unqualified lookup instead. That will find the QT_NAMESPACE one,
ignoring other overloads at global scope. And when non-namespaced,
will emit an ambiguity error in the presence of another matching get()
function at global scope.

Task-number: QTBUG-111598
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: Iea141ea543193394ba527b414caf31c1f3a2355b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2023-03-03 17:16:10 +01:00
parent 28f56f29bb
commit b955648224

View File

@ -176,7 +176,7 @@ QDBusError::QDBusError(const DBusError *error)
if (!error || !q_dbus_error_is_set(error))
return;
code = ::get(error->name);
code = get(error->name);
msg = QString::fromUtf8(error->message);
nm = QString::fromUtf8(error->name);
}
@ -191,7 +191,7 @@ QDBusError::QDBusError(const QDBusMessage &qdmsg)
if (qdmsg.type() != QDBusMessage::ErrorMessage)
return;
code = ::get(qdmsg.errorName().toUtf8().constData());
code = get(qdmsg.errorName().toUtf8().constData());
nm = qdmsg.errorName();
msg = qdmsg.errorMessage();
}
@ -238,7 +238,7 @@ QDBusError &QDBusError::operator=(const QDBusError &other)
QDBusError &QDBusError::operator=(const QDBusMessage &qdmsg)
{
if (qdmsg.type() == QDBusMessage::ErrorMessage) {
code = ::get(qdmsg.errorName().toUtf8().constData());
code = get(qdmsg.errorName().toUtf8().constData());
nm = qdmsg.errorName();
msg = qdmsg.errorMessage();
} else {