Object deletion problem


In a class method I use a scoped pointer on a object and when reaching end of scope I got a a malloc issue :

here is my code and the debug output (attached file) :

void audioToMidi(InputStream& soundStream, File& outputFile)


    AudioFormatManager audioFormatManager;


    ScopedPointer<AudioFormatReader> soundReader = audioFormatManager.createReaderFor(&soundStream);

[... (using the reader and so) ...]


Can you please tell me what I'm doing wrong?

Thank you.


Have a careful read of the docs for createReaderFor() - it needs to take ownership of the stream you give it. It looks like you're passing a pointer to some kind of local object there.