mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
fix(friendwidget): Use queued connection to avoid removing 'this'
Fix #4966 Since 'removeAction' can remove friend (who would have thought?) it must be connectd queued to avoid use after free.
This commit is contained in:
parent
3780acffe8
commit
9b4972e045
|
@ -195,7 +195,8 @@ void FriendWidget::onContextMenuCalled(QContextMenuEvent* event)
|
|||
if (!contentDialog || !contentDialog->hasFriendWidget(friendId, this)) {
|
||||
const auto removeAction = menu.addAction(
|
||||
tr("Remove friend", "Menu to remove the friend from our friendlist"));
|
||||
connect(removeAction, &QAction::triggered, [=]() { emit removeFriend(friendId); });
|
||||
connect(removeAction, &QAction::triggered, this, [=]() { emit removeFriend(friendId); },
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
menu.addSeparator();
|
||||
|
|
Loading…
Reference in New Issue
Block a user