aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
Diffstat (limited to 'gui')
-rw-r--r--gui/widgets/tab.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp
index 15e6a9d370..ed261c98ec 100644
--- a/gui/widgets/tab.cpp
+++ b/gui/widgets/tab.cpp
@@ -70,6 +70,12 @@ void TabWidget::init() {
}
TabWidget::~TabWidget() {
+ // If widgets were added or removed in the current tab, without tabs
+ // having been switched using setActiveTab() afterward, then the
+ // firstWidget in the _tabs list for the active tab may not be up to
+ // date. So update it now.
+ if (_activeTab != -1)
+ _tabs[_activeTab].firstWidget = _firstWidget;
_firstWidget = 0;
for (uint i = 0; i < _tabs.size(); ++i) {
delete _tabs[i].firstWidget;
@@ -274,6 +280,13 @@ void TabWidget::reflowLayout() {
_tabWidth = g_gui.xmlEval()->getVar("Globals.TabWidget.Tab.Width");
_titleVPad = g_gui.xmlEval()->getVar("Globals.TabWidget.Tab.Padding.Top");
+ // If widgets were added or removed in the current tab, without tabs
+ // having been switched using setActiveTab() afterward, then the
+ // firstWidget in the _tabs list for the active tab may not be up to
+ // date. So update it now.
+ if (_activeTab != -1)
+ _tabs[_activeTab].firstWidget = _firstWidget;
+
for (uint i = 0; i < _tabs.size(); ++i) {
Widget *w = _tabs[i].firstWidget;
while (w) {