Memory Leak With Observable List
Posted: 01 Dec 2023, 10:16
I get a memory leak error on shutdown when, elements are added to an ObservableList that is set as Source for a ListBox
These are the relevant parts of the code:
These are the relevant parts of the code:
Code: Select all
//Declaration
Noesis::ObservableCollection<PlaylistFile> playlist;
//Adding of elments
playlist.Add(Noesis::MakePtr<PlaylistFile>(path.c_str(),duration));
//Element Class
class PlaylistFile : public Noesis::BaseComponent
{
public:
PlaylistFile();
PlaylistFile(std::filesystem::path path);
PlaylistFile(std::filesystem::path path, int64_t dur_s);
Noesis::String ToString() const override;
std::filesystem::path get_path();
int64_t get_duration();
private:
std::filesystem::path path;
Noesis::String name;
int64_t duration;
NS_IMPLEMENT_INLINE_REFLECTION(PlaylistFile, Noesis::BaseComponent) {
NsProp("Name", &PlaylistFile::name);
};
};
//Destruction Call
playlist.Clear();
Noesis::GUI:Shutdown();