- Solid::StorageAccess* access = item->device().as<Solid::StorageAccess>();
- if (access) {
- connect(access, SIGNAL(teardownDone(Solid::ErrorType,QVariant,QString)),
- this, SLOT(slotStorageTeardownDone(Solid::ErrorType,QVariant)));
- access->teardown();
+ Solid::StorageAccess *tmp = item->device().as<Solid::StorageAccess>();
+ if (tmp) {
+ m_deviceToTearDown = tmp;
+ // disconnect the Solid::StorageAccess::teardownRequested
+ // to prevent emitting PlacesItemModel::storageTearDownExternallyRequested
+ // after we have emitted PlacesItemModel::storageTearDownRequested
+ disconnect(tmp, &Solid::StorageAccess::teardownRequested,
+ item->signalHandler(), &PlacesItemSignalHandler::onTearDownRequested);
+ emit storageTearDownRequested(tmp->filePath());