Hi, I have a problem I don't understand the behaviour.
I have a slot and there a instantiate a QList<int*>*;
void Class::slot()
{
QList<int>* list = new QList<int>();
qDebug() << "list_adress: " << list; //i.e. 0x7fbc24034870
deleteList(list);
qDebug() << "list_adress: " << list; // i expect 0x0, but output is 0x7fbc24034870
}
void Class::deleteList(QList<int>* list)
{
delete list;
list = NULL;
}
void Class::slot()
{
QList<int>* list = new QList<int>();
qDebug() << "list_adress: " << list; //i.e. 0x7fbc24034870
deleteList(list);
qDebug() << "list_adress: " << list; // i expect 0x0, but output is 0x7fbc24034870
}
void Class::deleteList(QList<int>* list)
{
delete list;
list = NULL;
}
To copy to clipboard, switch view to plain text mode
Why pointer is not deleted in slot?
Please help me!!??
Bookmarks