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.
This commit is contained in:
John Preston 2019-08-31 14:15:30 +03:00
parent 17fba16c23
commit 7be1c4ca2f
1 changed files with 4 additions and 2 deletions

View File

@ -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));
});
}
}