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,7 +375,13 @@ void LayerStackWidget::keyPressEvent(QKeyEvent *e) {
} }
void LayerStackWidget::mousePressEvent(QMouseEvent *e) { void LayerStackWidget::mousePressEvent(QMouseEvent *e) {
if (_hideByBackgroundClick) { crl::on_main(this, [=] { backgroundClicked(); });
}
void LayerStackWidget::backgroundClicked() {
if (!_hideByBackgroundClick) {
return;
}
if (const auto layer = currentLayer()) { if (const auto layer = currentLayer()) {
if (!layer->closeByOutsideClick()) { if (!layer->closeByOutsideClick()) {
return; return;
@ -387,7 +393,6 @@ void LayerStackWidget::mousePressEvent(QMouseEvent *e) {
} }
hideCurrent(anim::type::normal); hideCurrent(anim::type::normal);
} }
}
void LayerStackWidget::hideCurrent(anim::type animated) { void LayerStackWidget::hideCurrent(anim::type animated) {
return currentLayer() ? hideLayers(animated) : hideAll(animated); return currentLayer() ? hideLayers(animated) : hideAll(animated);

View File

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