Skip to content

Commit 416224f

Browse files
v-einhoffstadt
authored andcommitted
fix (mvTheme): Extra safety after std::move.
1 parent 404ae17 commit 416224f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/mvThemes.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,18 @@ void mvTheme::pop_theme_components()
9898
}
9999
else
100100
{
101+
// Below, we move from comp->_oldComponent to avoid mvThemeComponent
102+
// hanging around even after being deleted from the widget tree.
101103
if (_specificEnabled == comp->_specificEnabled)
102104
{
103-
// Nullifying comp->_oldComponent to avoid mvThemeComponent
104-
// hanging around even after being deleted from the widget tree.
105105
*comp->_specificComponentPtr = std::move(comp->_oldComponent);
106106
}
107107
else
108108
{
109109
*comp->_specificDisabledComponentPtr = std::move(comp->_oldComponent);
110110
}
111-
111+
// Just in case anyone wants to reuse it
112+
comp->_oldComponent = nullptr;
112113
}
113114
}
114115
}

0 commit comments

Comments
 (0)