Blob Blame History Raw
From 241d21361a677fa44b3bd0c53e65f12cd23c5ba3 Mon Sep 17 00:00:00 2001
From: David Rosca <nowrep@gmail.com>
Date: Tue, 5 May 2015 17:04:06 +0200
Subject: [PATCH 3/3] Only delete adapter when removed from m_adapters hash

BUG: 346329
---
 bluedevil/bluedevilmanager_p.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bluedevil/bluedevilmanager_p.cpp b/bluedevil/bluedevilmanager_p.cpp
index 3c45f2a..af63593 100644
--- a/bluedevil/bluedevilmanager_p.cpp
+++ b/bluedevil/bluedevilmanager_p.cpp
@@ -162,6 +162,10 @@ void ManagerPrivate::_k_interfacesRemoved(const QDBusObjectPath &objectPath, con
             }
             if (adapter) {
                 emit m_q->adapterRemoved(adapter);
+
+                if (adapter->devices().isEmpty()) {
+                    adapter->deleteLater();
+                }
             }
             if (m_adapters.isEmpty()) {
                 emit m_q->usableAdapterChanged(0);
@@ -180,7 +184,7 @@ void ManagerPrivate::_k_interfacesRemoved(const QDBusObjectPath &objectPath, con
             if (adapter) {
                 adapter->removeDevice(object);
 
-                if (adapter->devices().isEmpty()) {
+                if (adapter->devices().isEmpty() && !m_adapters.values().contains(adapter)) {
                     adapter->deleteLater();
                 }
             }
-- 
2.4.0