Code review comment for lp:~dandrader/qtmir/content-hub-clipboard

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

> +void Clipboard::setMimeData(QMimeData* mimeData, QClipboard::Mode mode)
> + QDBusPendingCall reply = mContentHub->createPaste(*mimeData);
> +
> + // Don't care whether it succeeded
> + auto *watcher = new QDBusPendingCallWatcher(reply, this);
> + connect(watcher, &QDBusPendingCallWatcher::finished,
> + watcher, &QObject::deleteLater);
> if you don't care, why do you do this at all? I would think just calling
> createPaste and throwing away the returned QDBusPendingCall is enough.

I also thought that when I first wrote it. But the destructor of a QDBusPendingCall cancels the call if it's still ongoing and we don't want that. Thus we have to keep a QDBusPendingCall instance around (such as a QDBusPendingCallWatcher) until the remote method call is done.

« Back to merge proposal