From 34b0f6f01406cf7846865cf3bc9e81a522d649a4 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 1 Feb 2019 11:09:14 +0300 Subject: [PATCH] Fix crash in group migration. --- Telegram/SourceFiles/info/info_wrap_widget.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/info/info_wrap_widget.cpp b/Telegram/SourceFiles/info/info_wrap_widget.cpp index b224f3a255..c9fac7699f 100644 --- a/Telegram/SourceFiles/info/info_wrap_widget.cpp +++ b/Telegram/SourceFiles/info/info_wrap_widget.cpp @@ -620,7 +620,16 @@ not_null WrapWidget::topWidget() const { } void WrapWidget::showContent(object_ptr content) { - _content = std::move(content); + if (auto old = std::exchange(_content, std::move(content))) { + old->hide(); + + // Content destructor may invoke closeBox() that will try to + // start layer animation. If we won't detach old content from + // its parent WrapWidget layer animation will be started with a + // partially destructed grand-child widget and result in a crash. + old->setParent(nullptr); + old.destroy(); + } _content->show(); _additionalScroll = 0; //_anotherTabMemento = nullptr;