1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

refactor(widget): Extract friendId in variable

This commit is contained in:
Diadlo 2017-08-11 00:01:42 +03:00
parent a1c7bb3c43
commit 775d9987a3
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727

View File

@ -1456,7 +1456,8 @@ void Widget::removeFriend(Friend* f, bool fake)
}
}
FriendWidget* widget = friendWidgets[f->getId()];
const uint32_t friendId = f->getId();
FriendWidget* widget = friendWidgets[friendId];
widget->setAsInactiveChatroom();
if (widget == activeChatroomWidget) {
activeChatroomWidget = nullptr;
@ -1465,16 +1466,16 @@ void Widget::removeFriend(Friend* f, bool fake)
contactListWidget->removeFriendWidget(widget);
ContentDialog* lastDialog = ContentDialog::getFriendDialog(f->getId());
ContentDialog* lastDialog = ContentDialog::getFriendDialog(friendId);
if (lastDialog != nullptr) {
lastDialog->removeFriend(f->getId());
lastDialog->removeFriend(friendId);
}
FriendList::removeFriend(f->getId(), fake);
Nexus::getCore()->removeFriend(f->getId(), fake);
FriendList::removeFriend(friendId, fake);
Nexus::getCore()->removeFriend(friendId, fake);
friendWidgets.remove(f->getId());
friendWidgets.remove(friendId);
delete widget;
delete f;
if (contentLayout && contentLayout->mainHead->layout()->isEmpty()) {