Delete a element from QList



  • 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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.