From 5f29e9c18994da9812dd21a60b5ed4edf3dc48fd Mon Sep 17 00:00:00 2001 From: Thanos Doukoudakis Date: Fri, 23 Feb 2018 13:42:33 +0000 Subject: Fix a crash that occurs with closed chat tabs after resizing trellis This patch address an issue where, after resizing trellis in a smaller grid size, all closed tabs widgets (ChatWindows, Debug Console etc) that were in a grid cell that got removed, were being destroyed leading to some crashes whenever the widget was used again. Test-Information: Tested the changes in windows with Qt 5.8 and Ubuntu 17.10 with Qt 5.9.1. Tested the client behaviour when opening, closing and re-opening multiple tabs (chat windows, debug console, File transfer overview), before and after resizing the trellis. Change-Id: I923299fe90aa39737d6a3e0ace107018f126880e diff --git a/Swift/QtUI/Trellis/QtDynamicGridLayout.cpp b/Swift/QtUI/Trellis/QtDynamicGridLayout.cpp index b753ffa..2509b3f 100644 --- a/Swift/QtUI/Trellis/QtDynamicGridLayout.cpp +++ b/Swift/QtUI/Trellis/QtDynamicGridLayout.cpp @@ -144,7 +144,9 @@ void QtDynamicGridLayout::removeTab(int index) { int tabIndex = -1; QtTabWidget* tabWidget = indexToTabWidget(index, tabIndex); if (tabWidget) { + QWidget* tab = tabWidget->widget(tabIndex); tabWidget->removeTab(tabIndex); + tab->setParent(nullptr); } } -- cgit v0.10.2-6-g49f6