G
gianpaolof
Hello!
I was looking at the following piece of code:
void MyClass::myMethod( )
{
MyItem *item = NULL;
item = new MyItem( ..., iconView, ..., ...);
}
I thought it was necessary to delete the item before the end of
myMethod scope to avoid
memory leak.
Then I looked at the MyItem constructor:
class MyItem : public MyIconViewItem
{
public:
MyItem(..., MyIconView *parent, ..., ...);
}
Documentation for MyIconViewItem says:
When the MyIconView is deleted, all items in it are deleted
automatically.
Can I assume that the memory above is deallocated when MyIconView is
deleted?
Best regards.
Gianpaolo
I was looking at the following piece of code:
void MyClass::myMethod( )
{
MyItem *item = NULL;
item = new MyItem( ..., iconView, ..., ...);
}
I thought it was necessary to delete the item before the end of
myMethod scope to avoid
memory leak.
Then I looked at the MyItem constructor:
class MyItem : public MyIconViewItem
{
public:
MyItem(..., MyIconView *parent, ..., ...);
}
Documentation for MyIconViewItem says:
When the MyIconView is deleted, all items in it are deleted
automatically.
Can I assume that the memory above is deallocated when MyIconView is
deleted?
Best regards.
Gianpaolo