Commit 539d7a90 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Revert "Remove unneeded const_casts"

This reverts commit 9135ad06.
parent 774fe41d
Pipeline #92027 passed with stage
in 4 minutes and 45 seconds
......@@ -45,7 +45,7 @@ DBusResponseWaiter::DBusResponseWaiter()
QVariant DBusResponseWaiter::waitForReply(QVariant variant) const
{
if (QDBusPendingCall* call = extractPendingCall(variant))
if (QDBusPendingCall* call = const_cast<QDBusPendingCall*>(extractPendingCall(variant)))
{
call->waitForFinished();
......@@ -77,7 +77,7 @@ DBusAsyncResponse::DBusAsyncResponse(QObject* parent)
void DBusAsyncResponse::setPendingCall(QVariant variant)
{
if (QDBusPendingCall* call = DBusResponseWaiter::instance()->extractPendingCall(variant))
if (QDBusPendingCall* call = const_cast<QDBusPendingCall*>(DBusResponseWaiter::instance()->extractPendingCall(variant)))
{
QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(*call);
watcher->setProperty("pengingCallVariant", variant);
......@@ -124,13 +124,13 @@ void DBusAsyncResponse::onTimeout()
Q_EMIT error(QStringLiteral("timeout when waiting dbus response!"));
}
QDBusPendingCall* DBusResponseWaiter::extractPendingCall(QVariant& variant) const
const QDBusPendingCall* DBusResponseWaiter::extractPendingCall(QVariant& variant) const
{
for (int type : qAsConst(m_registered))
{
if (variant.canConvert(QVariant::Type(type)))
{
return static_cast<QDBusPendingCall*>(variant.value<void *>());
return reinterpret_cast<const QDBusPendingCall*>(variant.constData());
}
}
......
......@@ -25,7 +25,7 @@ public:
///extract QDbusPendingCall from \p variant and blocks until completed
Q_INVOKABLE QVariant waitForReply(QVariant variant) const;
QDBusPendingCall* extractPendingCall(QVariant& variant) const;
const QDBusPendingCall* extractPendingCall(QVariant& variant) const;
private:
DBusResponseWaiter();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment