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:
Mark de Wever 2009-09-16 18:13:01 +00:00
parent 8d03024ed3
commit cb9a8adc40

View file

@ -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());
}
}