Fix crash in group migration.
This commit is contained in:
		
							parent
							
								
									f5cc93ec64
								
							
						
					
					
						commit
						34b0f6f014
					
				
					 1 changed files with 10 additions and 1 deletions
				
			
		| 
						 | 
					@ -620,7 +620,16 @@ not_null<Ui::RpWidget*> WrapWidget::topWidget() const {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void WrapWidget::showContent(object_ptr<ContentWidget> content) {
 | 
					void WrapWidget::showContent(object_ptr<ContentWidget> 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();
 | 
						_content->show();
 | 
				
			||||||
	_additionalScroll = 0;
 | 
						_additionalScroll = 0;
 | 
				
			||||||
	//_anotherTabMemento = nullptr;
 | 
						//_anotherTabMemento = nullptr;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue