Fix repeated subscriptions on layer wrapping type change.

This commit is contained in:
John Preston 2022-05-23 14:35:39 +04:00
parent 8035fe8771
commit 7fb99319bb
2 changed files with 7 additions and 5 deletions

View File

@ -244,7 +244,7 @@ int LayerWidget::MinimalSupportedWidth() {
}
int LayerWidget::resizeGetHeight(int newWidth) {
if (!parentWidget() || !_content) {
if (!parentWidget() || !_content || !newWidth) {
return 0;
}
constexpr auto kMaxAttempts = 16;

View File

@ -46,14 +46,16 @@ void SectionWidget::init() {
rpl::combine(
sizeValue(),
_content->desiredHeightValue()
) | rpl::start_with_next([wrap = _content.data()](QSize size, int) {
) | rpl::filter([=] {
return (_content != nullptr);
}) | rpl::start_with_next([=](QSize size, int) {
const auto expanding = false;
const auto additionalScroll = st::boxRadius;
const auto full = !wrap->scrollBottomSkip();
const auto full = !_content->scrollBottomSkip();
const auto height = size.height() - (full ? 0 : st::boxRadius);
const auto wrapGeometry = QRect{ 0, 0, size.width(), height };
wrap->updateGeometry(wrapGeometry, expanding, additionalScroll);
}, _content->lifetime());
_content->updateGeometry(wrapGeometry, expanding, additionalScroll);
}, lifetime());
_connecting = std::make_unique<Window::ConnectionState>(
_content.data(),