fix segfault on disconnect (#5447)

* add new param to closeRequest

* don't emit signals in dtors

* send closeRequest

* fix build failure

* fix build failure

* see if we can get away with the overloaded triggered

* fix build failure
This commit is contained in:
RickyRister 2025-01-11 19:19:45 -08:00 committed by GitHub
parent 3b544a36a8
commit 7347ba88ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 59 additions and 67 deletions

View file

@ -101,7 +101,7 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor,
hbox->addWidget(userList, 1);
aLeaveRoom = new QAction(this);
connect(aLeaveRoom, SIGNAL(triggered()), this, SLOT(actLeaveRoom()));
connect(aLeaveRoom, &QAction::triggered, this, [this] { closeRequest(); });
roomMenu = new QMenu(this);
roomMenu->addAction(aLeaveRoom);
@ -135,11 +135,6 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor,
setCentralWidget(mainWidget);
}
TabRoom::~TabRoom()
{
emit roomClosing(this);
}
void TabRoom::retranslateUi()
{
gameSelector->retranslateUi();
@ -175,9 +170,11 @@ void TabRoom::actShowPopup(const QString &message)
}
}
void TabRoom::closeRequest()
void TabRoom::closeRequest(bool /*forced*/)
{
actLeaveRoom();
sendRoomCommand(prepareRoomCommand(Command_LeaveRoom()));
emit roomClosing(this);
deleteLater();
}
void TabRoom::tabActivated()
@ -216,12 +213,6 @@ void TabRoom::sayFinished(const Response &response)
chatView->appendMessage(tr("You are flooding the chat. Please wait a couple of seconds."));
}
void TabRoom::actLeaveRoom()
{
sendRoomCommand(prepareRoomCommand(Command_LeaveRoom()));
deleteLater();
}
void TabRoom::actClearChat()
{
chatView->clearChat();