From acfc47b6047324ad59ee3da3ddb3bd8ad8f94a03 Mon Sep 17 00:00:00 2001 From: jzxc95 <907297917@qq.com> Date: Wed, 25 Aug 2021 17:35:57 +0800 Subject: [PATCH] fix when ap remove segament fault & can not remove a item --- src/backend/dbus-interface/kywirelessnetresource.cpp | 1 - src/frontend/tab-pages/wlanpage.cpp | 7 +++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/backend/dbus-interface/kywirelessnetresource.cpp b/src/backend/dbus-interface/kywirelessnetresource.cpp index 18eda755..3c4faceb 100644 --- a/src/backend/dbus-interface/kywirelessnetresource.cpp +++ b/src/backend/dbus-interface/kywirelessnetresource.cpp @@ -93,7 +93,6 @@ void KyWirelessNetResource::getWirelessActiveConnection(NetworkManager::ActiveCo map.clear(); NetworkManager::ActiveConnection::List activeConnectionList; - map.clear(); activeConnectionList.clear(); activeConnectionList = m_networkResourceInstance->m_activeConns; if (activeConnectionList.isEmpty()) { diff --git a/src/frontend/tab-pages/wlanpage.cpp b/src/frontend/tab-pages/wlanpage.cpp index cf16b9d2..18aacb8c 100644 --- a/src/frontend/tab-pages/wlanpage.cpp +++ b/src/frontend/tab-pages/wlanpage.cpp @@ -203,10 +203,9 @@ void WlanPage::onWlanRemoved(QString interface, QString ssid) { if (!m_itemsMap.contains(ssid)) { return; } qDebug() << "A Wlan Removed! interface = " << interface << "; ssid = " << ssid << Q_FUNC_INFO <<__LINE__; - m_inactivatedNetListWidget->removeItemWidget(m_itemsMap.value(ssid)); - m_inactivatedNetListWidget->setFixedHeight(m_inactivatedNetListWidget->height() - - m_inactivatedNetListWidget->itemWidget(m_itemsMap.value(ssid))->height() - - NET_LIST_SPACING); + int height = m_inactivatedNetListWidget->itemWidget(m_itemsMap.value(ssid))->height(); + m_inactivatedNetListWidget->takeItem(m_inactivatedNetListWidget->row(m_itemsMap.value(ssid))); + m_inactivatedNetListWidget->setFixedHeight(m_inactivatedNetListWidget->height() - height - NET_LIST_SPACING); m_inactivatedWlanListAreaCentralWidget->setFixedHeight(m_inactivatedNetListWidget->height() + m_hiddenWlanLabel->height()); m_itemsMap.remove(ssid); }