Leaked objects when parsing XML

#1

Hi there,

I’m trying to implement a MusicXML parser, but I encounter an error that I’m not able to resolve…
Here is my code :

File file("C:\\my\\path\\myFile.xml");
 
XmlDocument document(file);

XmlElement* root = document.getDocumentElement();

The error Visual Studio is throwing is :

Nom Valeur Type
:arrow_forward: this 0x00007ff7fbecae78 {MyProject.exe!juce::LeakedObjectDetector<juce::XmlElement>::LeakCounter counter} {…} juce::LeakedObjectDetector<juce::XmlElement>::LeakCounter *

Thanks in advance for your time !

Thibault

0 Likes

#2

You need to delete the XmlElement you get from getDocumentElement. Or rather, use a smart pointer, for example :

std::unique_ptr<XmlElement> root{ document.getDocumentElement() };
3 Likes

#3

Thanks alot !

0 Likes