2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-02 23:45:44 +00:00

Fix crash on layer -> section migration.

This commit is contained in:
John Preston
2018-12-04 11:19:28 +04:00
parent 679347309e
commit 71efd10c83
3 changed files with 57 additions and 15 deletions

View File

@@ -497,16 +497,16 @@ void LayerStackWidget::closeLayer(not_null<LayerWidget*> layer) {
}
void LayerStackWidget::updateLayerBoxes() {
auto getLayerBox = [this]() {
if (auto layer = currentLayer()) {
const auto layerBox = [&] {
if (const auto layer = currentLayer()) {
return layer->geometry();
}
return QRect();
};
auto getSpecialLayerBox = [this]() {
return _specialLayer ? _specialLayer->geometry() : QRect();
};
_background->setLayerBoxes(getSpecialLayerBox(), getLayerBox());
}();
const auto specialLayerBox = _specialLayer
? _specialLayer->geometry()
: QRect();
_background->setLayerBoxes(specialLayerBox, layerBox);
update();
}
@@ -566,15 +566,28 @@ void LayerStackWidget::startAnimation(
}
void LayerStackWidget::resizeEvent(QResizeEvent *e) {
const auto weak = make_weak(this);
_background->setGeometry(rect());
if (!weak) {
return;
}
if (_specialLayer) {
_specialLayer->parentResized();
if (!weak) {
return;
}
}
if (auto layer = currentLayer()) {
if (const auto layer = currentLayer()) {
layer->parentResized();
if (!weak) {
return;
}
}
if (_mainMenu) {
_mainMenu->resize(_mainMenu->width(), height());
if (!weak) {
return;
}
}
updateLayerBoxes();
}