2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Fix a crash in main settings destructor.

Fixes #27544.
This commit is contained in:
John Preston
2024-03-12 23:19:59 +04:00
parent c6f49486ee
commit 8c5db25476
3 changed files with 15 additions and 1 deletions

View File

@@ -174,7 +174,16 @@ Cover::Cover(
}, _name->lifetime());
}
Cover::~Cover() = default;
Cover::~Cover() {
if (_emojiStatusPanel.hasFocus()) {
// Panel will try to return focus to the layer widget, the problem is
// we are destroying the layer widget probably right now and focusing
// it will lead to a crash, because it destroys its children (how we
// got here) after it clears focus out of itself. So if you return
// the focus inside a child destructor, it won't be cleared at all.
window()->setFocus();
}
}
void Cover::setupChildGeometry() {
using namespace rpl::mappers;