Skip to content

Commit

Permalink
Move dbus watcher connect calls to one place
Browse files Browse the repository at this point in the history
  • Loading branch information
rainemak committed May 27, 2019
1 parent 9daf6c5 commit 620b7d9
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/udisks2block.cpp
Expand Up @@ -63,15 +63,7 @@ UDisks2::Block::Block(const QString &path, const UDisks2::InterfacePropertyMap &
qCInfo(lcMemoryCardLog) << "Drive properties:" << driveProperties;
m_drive = driveProperties;
});

connect(m_pendingDrive.data(), &QObject::destroyed, this, &Block::complete);
});

connect(m_pendingEncrypted.data(), &QObject::destroyed, this, &Block::complete);
connect(m_pendingFileSystem.data(), &QObject::destroyed, this, &Block::complete);
connect(m_pendingPartitionTable.data(), &QObject::destroyed, this, &Block::complete);
connect(m_pendingPartition.data(), &QObject::destroyed, this, &Block::complete);
connect(m_pendingBlock.data(), &QObject::destroyed, this, &Block::complete);
} else {
if (m_mountable) {
QVariantMap map = interfacePropertyMap.value(UDISKS2_FILESYSTEM_INTERFACE);
Expand Down Expand Up @@ -524,6 +516,8 @@ void UDisks2::Block::getProperties(const QString &path, const QString &interface
m_connection);
QDBusPendingCall pendingCall = dbusPropertyInterface.asyncCall(DBUS_GET_ALL, interface);
watcherPointer = new QDBusPendingCallWatcher(pendingCall, this);

connect(watcherPointer.data(), &QObject::destroyed, this, &Block::complete);
connect(watcherPointer.data(), &QDBusPendingCallWatcher::finished, this, [success, path, interface](QDBusPendingCallWatcher *watcher) {
if (watcher->isValid() && watcher->isFinished()) {
QDBusPendingReply<> reply = *watcher;
Expand Down

0 comments on commit 620b7d9

Please sign in to comment.