From 884be305988ce9e708b2556981b812187e0c7789 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Sun, 20 Oct 2024 00:15:19 +0200 Subject: [PATCH] Simplify ConversationsDbusInterface We have one ConversationsDbusInterface per plugin, and one plugin per device So each interface is always bound to one device and we don't need to maintain an internal list --- plugins/sms/conversationsdbusinterface.cpp | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/plugins/sms/conversationsdbusinterface.cpp b/plugins/sms/conversationsdbusinterface.cpp index 014f460de..94b4e5868 100644 --- a/plugins/sms/conversationsdbusinterface.cpp +++ b/plugins/sms/conversationsdbusinterface.cpp @@ -17,8 +17,6 @@ #include "kdeconnect_conversations_debug.h" -QMap ConversationsDbusInterface::liveConversationInterfaces; - ConversationsDbusInterface::ConversationsDbusInterface(KdeConnectPlugin *plugin) : QDBusAbstractAdaptor(const_cast(plugin->device())) , m_device(plugin->device()->id()) @@ -26,17 +24,6 @@ ConversationsDbusInterface::ConversationsDbusInterface(KdeConnectPlugin *plugin) , m_smsInterface(m_device) { ConversationMessage::registerDbusType(); - - // Check for an existing interface for the same device - // If there is already an interface for this device, we can safely delete is since we have just replaced it - const auto &oldInterfaceItr = ConversationsDbusInterface::liveConversationInterfaces.find(m_device); - if (oldInterfaceItr != ConversationsDbusInterface::liveConversationInterfaces.end()) { - ConversationsDbusInterface *oldInterface = oldInterfaceItr.value(); - oldInterface->deleteLater(); - ConversationsDbusInterface::liveConversationInterfaces.erase(oldInterfaceItr); - } - - ConversationsDbusInterface::liveConversationInterfaces[m_device] = this; } ConversationsDbusInterface::~ConversationsDbusInterface() @@ -47,10 +34,6 @@ ConversationsDbusInterface::~ConversationsDbusInterface() conversationsWaitingForMessages.clear(); waitingForMessages.wakeAll(); waitingForMessagesLock.unlock(); - - // Erase this interface from the list of known interfaces - const auto myIterator = ConversationsDbusInterface::liveConversationInterfaces.find(m_device); - ConversationsDbusInterface::liveConversationInterfaces.erase(myIterator); } QVariantList ConversationsDbusInterface::activeConversations()