Commit c224e8f1 authored by Leander Schulten's avatar Leander Schulten
Browse files

Fix bug in modelvector that cause the Lichtsteuerung to crash

parent 24e5a2b2
......@@ -117,7 +117,7 @@ public:
return r;
}
typename std::vector<Type>::iterator erase(typename std::vector<Type>::const_iterator i){
const auto pos = i-model.begin();
const auto pos = std::distance(model.cbegin(),i);
beginRemoveRows(QModelIndex(),pos,pos);
const auto result = model.erase(i);
endRemoveRows();
......@@ -141,9 +141,11 @@ public:
template<typename Predicate>
void remove_if(Predicate p){
for (auto i = cbegin();i!=cend();++i) {
for (auto i = cbegin();i!=cend();) {
if(p(*i)){
i = erase(i);
}else{
++i;
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment