Fix crash in main menu right button click.

Fixes #5462.
This commit is contained in:
John Preston 2018-12-12 09:47:24 +04:00
parent ffbd488e93
commit a167a8587b
2 changed files with 17 additions and 11 deletions

View file

@ -375,18 +375,23 @@ void LayerStackWidget::keyPressEvent(QKeyEvent *e) {
}
void LayerStackWidget::mousePressEvent(QMouseEvent *e) {
if (_hideByBackgroundClick) {
if (const auto layer = currentLayer()) {
if (!layer->closeByOutsideClick()) {
return;
}
} else if (const auto special = _specialLayer.data()) {
if (!special->closeByOutsideClick()) {
return;
}
}
hideCurrent(anim::type::normal);
crl::on_main(this, [=] { backgroundClicked(); });
}
void LayerStackWidget::backgroundClicked() {
if (!_hideByBackgroundClick) {
return;
}
if (const auto layer = currentLayer()) {
if (!layer->closeByOutsideClick()) {
return;
}
} else if (const auto special = _specialLayer.data()) {
if (!special->closeByOutsideClick()) {
return;
}
}
hideCurrent(anim::type::normal);
}
void LayerStackWidget::hideCurrent(anim::type animated) {

View file

@ -134,6 +134,7 @@ private:
void replaceBox(
object_ptr<BoxContent> box,
anim::type animated);
void backgroundClicked();
LayerWidget *pushBox(
object_ptr<BoxContent> box,