Fix another linked size related crash.
Linked widgets could be added more than once to the linked size list and upon destruction were only removed once. Avoid double adding and validate that upon destuction there are no duplicates.
This commit is contained in:
parent
8d03024ed3
commit
cb9a8adc40
1 changed files with 7 additions and 1 deletions
|
@ -661,7 +661,10 @@ void twindow::add_linked_widget(const std::string& id, twidget* widget)
|
|||
assert(widget);
|
||||
assert(has_linked_size_group(id));
|
||||
|
||||
linked_size_[id].widgets.push_back(widget);
|
||||
std::vector<twidget*>& widgets = linked_size_[id].widgets;
|
||||
if(std::find(widgets.begin(), widgets.end(), widget) == widgets.end()) {
|
||||
widgets.push_back(widget);
|
||||
}
|
||||
}
|
||||
|
||||
void twindow::remove_linked_widget(const std::string& id
|
||||
|
@ -677,6 +680,9 @@ void twindow::remove_linked_widget(const std::string& id
|
|||
|
||||
if(itor != widgets.end()) {
|
||||
widgets.erase(itor);
|
||||
|
||||
assert(std::find(widgets.begin(), widgets.end(), widget)
|
||||
== widgets.end());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue