From 7be1c4ca2f7bb185428509337d302c0cf1e451c0 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sat, 31 Aug 2019 14:15:30 +0300 Subject: [PATCH] Fix crash in right click on CalendarBox. Any attempt to destroy a widget on right click will crash, because Qt anyway sends QContextMenuEvent to the same widget. Fixes #6464. --- Telegram/SourceFiles/boxes/calendar_box.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/boxes/calendar_box.cpp b/Telegram/SourceFiles/boxes/calendar_box.cpp index b7db290c2..31d5c62b8 100644 --- a/Telegram/SourceFiles/boxes/calendar_box.cpp +++ b/Telegram/SourceFiles/boxes/calendar_box.cpp @@ -389,8 +389,10 @@ void CalendarBox::Inner::mouseReleaseEvent(QMouseEvent *e) { auto pressed = _pressed; setPressed(kEmptySelection); if (pressed != kEmptySelection && pressed == _selected) { - const auto onstack = _dateChosenCallback; - onstack(_context->dateFromIndex(pressed)); + crl::on_main(this, [=] { + const auto onstack = _dateChosenCallback; + onstack(_context->dateFromIndex(pressed)); + }); } }