You have been subscribed to a public bug:

Something that showed up when reviewing the remote_client branch, but
not something that might be worth fixing post-merge.

The QDBusPendingReply<T> type is a subclass of QDBusPendingCall.  It
also has a constructor that allows implicit conversion from a
QDBusPendingCall instance.  This means that QDBusPendingReply<T1> can be
implicitly converted to QDBusPendingReply<T2>.  So it would be a good
idea to minimise the number of times we spell out this type name in the
source.

Currently we've got code like the following:

    auto process_roots_reply = 
[this](QDBusPendingReply<QList<storage::internal::ItemMetadata>> const& reply,
                                      QFutureInterface<QVector<Root::SPtr>>& qf)
    {
    ...
    };
    auto handler = new Handler<QVector<Root::SPtr>>(this, provider_->Roots(), 
process_roots_reply);

So we've got no protection if the return value of provider_->Roots()
actually matches the type of the first argument to the closure.
Instead, we could write it as:

    auto reply = provider_->Roots();
    auto process_roots_reply = [this](decltype(reply) const& reply,
                                      QFutureInterface<QVector<Root::SPtr>>& qf)
    {
    ...
    };
    auto handler = new Handler<QVector<Root::SPtr>>(this, reply, 
process_roots_reply);

Now we know the closure argument is of the correct type.

** Affects: storage-framework (Ubuntu)
     Importance: Undecided
     Assignee: Michi Henning (michihenning)
         Status: Fix Committed

-- 
use decltype(reply) when declaring the closures passed to 
remote_client::Handler<T>
https://bugs.launchpad.net/bugs/1600161
You received this bug notification because you are a member of Ubuntu Bugs, 
which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to