Fix a use-after-free error during logout
This commit is contained in:
parent
b10e1bafc8
commit
e29fceaee4
6 changed files with 34 additions and 28 deletions
|
|
@ -169,24 +169,6 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent)
|
|||
});
|
||||
|
||||
connect(this, &ChatPage::loggedOut, this, &ChatPage::logout);
|
||||
connect(user_info_widget_, &UserInfoWidget::logout, this, [this]() {
|
||||
http::client()->logout(
|
||||
[this](const mtx::responses::Logout &, mtx::http::RequestErr err) {
|
||||
if (err) {
|
||||
// TODO: handle special errors
|
||||
emit contentLoaded();
|
||||
nhlog::net()->warn(
|
||||
"failed to logout: {} - {}",
|
||||
mtx::errors::to_string(err->matrix_error.errcode),
|
||||
err->matrix_error.error);
|
||||
return;
|
||||
}
|
||||
|
||||
emit loggedOut();
|
||||
});
|
||||
|
||||
emit showOverlayProgressBar();
|
||||
});
|
||||
|
||||
connect(top_bar_, &TopRoomBar::showRoomList, splitter, &Splitter::showFullRoomList);
|
||||
connect(top_bar_, &TopRoomBar::inviteUsers, this, [this](QStringList users) {
|
||||
|
|
@ -1332,3 +1314,22 @@ ChatPage::isSideBarExpanded()
|
|||
{
|
||||
return sideBar_->size().width() > ui::sidebar::NormalSize;
|
||||
}
|
||||
|
||||
void
|
||||
ChatPage::initiateLogout()
|
||||
{
|
||||
http::client()->logout([this](const mtx::responses::Logout &, mtx::http::RequestErr err) {
|
||||
if (err) {
|
||||
// TODO: handle special errors
|
||||
emit contentLoaded();
|
||||
nhlog::net()->warn("failed to logout: {} - {}",
|
||||
mtx::errors::to_string(err->matrix_error.errcode),
|
||||
err->matrix_error.error);
|
||||
return;
|
||||
}
|
||||
|
||||
emit loggedOut();
|
||||
});
|
||||
|
||||
emit showOverlayProgressBar();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue