QMediaPlaylist keeps building playlist larger
Trying to load playlist after playlist into a QMediaPlayer in a QVideoWidget, the QMediaPlaylist just keeps adding to the previous playlist however.
even after calling
Code:
playlist->~QMediaPlayList();
videoWidget->~QVideoWidget();
after playlist is done, and before starting a new one.
playlist and videoWidget are in my header like this:
Code:
QVideoWidget *videoWidget;
QMediaPlaylist *playlist;
I even disconnect all the QMediaPlayer connections and the QMediaPlaylist connection...
any tips on this? I thought a deconstructor got rid of the class object instance so that a new one can be dynamically created.
Re: QMediaPlaylist keeps building playlist larger
The destructor runs object cleanup code, just like the constructor running the object's initialization code.
Neither is involved in deallocating or allocating an object.
That's what the delete and new operators do for heap allocated objects and what the compiler generated code does for stack allocated objects.
Cheers,
_
Re: QMediaPlaylist keeps building playlist larger
god damn. was forgetting to empty my QList<Type> before appending to it & creating a new playlist. tnank god for QTextStream. can an admin delete this thread? thinking I should get a solid 8 hours sleep....
Re: QMediaPlaylist keeps building playlist larger
Code:
playlist->~QMediaPlayList();
videoWidget->~QVideoWidget();
This is a pretty bizarre coding convention. If you want to get rid of something, just use the delete operator, don't call the destructor directly.
Code:
delete playlist;
delete videoWidget;
All your code is doing is telling the object instance to clean itself up, it isn't actually getting rid of the memory allocated to hold the instance. So if this is the way you think you've been freeing objects created on the heap, it isn't doing that. The instances are still there, they are just invalid because they've been destructed but not deallocated.