Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
fix(group): Fix crash on group quit
Browse files Browse the repository at this point in the history
Fix 'GroupWidget' removing
  • Loading branch information
Diadlo committed Aug 19, 2017
1 parent e11352e commit e606d3c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/widget/friendlistwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,12 @@ void FriendListWidget::addFriendWidget(FriendWidget* w, Status s, int circleInde
circleWidget->addFriendWidget(w, s);
}

void FriendListWidget::removeGroupWidget(GroupWidget* w)
{
groupLayout.removeSortedWidget(w);
w->deleteLater();
}

void FriendListWidget::removeFriendWidget(FriendWidget* w)
{
const Friend* contact = w->getFriend();
Expand Down
1 change: 1 addition & 0 deletions src/widget/friendlistwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class FriendListWidget : public QWidget

void addGroupWidget(GroupWidget* widget);
void addFriendWidget(FriendWidget* w, Status s, int circleIndex);
void removeGroupWidget(GroupWidget* w);
void removeFriendWidget(FriendWidget* w);
void addCircleWidget(int id);
void addCircleWidget(FriendWidget* widget = nullptr);
Expand Down
3 changes: 2 additions & 1 deletion src/widget/widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1791,7 +1791,8 @@ void Widget::removeGroup(Group* g, bool fake)
groupWidgets.remove(groupId);

Nexus::getCore()->removeGroup(groupId, fake);
delete widget;
contactListWidget->removeGroupWidget(widget);

delete g;
if (contentLayout && contentLayout->mainHead->layout()->isEmpty()) {
onAddClicked();
Expand Down

0 comments on commit e606d3c

Please sign in to comment.