Delete a element from QList
General and Desktop
1
Posts
1
Posters
1.3k
Views
1
Watching
-
wrote on 18 Nov 2014, 09:07 last edited by
i write like this:
@
for(QList<A*>::iterator it = listA.begin(); it != listA.end(); ++it)
{
A* a = *it;
if(a)
{
if (a->shouldDelete())
{
listA.removeAll(a); //removeOne & erase are alsoo tried, but crash the same.....
delete a;
a = NULL;
}
else
a->func(); //crashed here!!!
}
}
@
what is the error i made?
thank you
1/1