Hi!
I’m doing my dissertation developing a VST3 plugin (Using JUCE, Visual Studio 2019 and Cakewalk as the DAW for testing) that loads a file and analyze his properties, however, I got a leaked object and I suspect of the launchAsync part in my code, here is the “Select a file” part:
void ProyectoAudioProcessor::botonAbrirClickeado()
{
SelectorDeArchivos = std::make_unique<FileChooser>("Seleccione un archivo", File::getSpecialLocation(File::userDesktopDirectory), "*.wav; *.aiff; *.mp3; *.flac; *.ogg; *.lame; *.wma");
auto Banderas = FileBrowserComponent::openMode | FileBrowserComponent::canSelectFiles;
SelectorDeArchivos->launchAsync(Banderas, [this](const FileChooser& chooser) {
File ArchivoSeleccionado(chooser.getResult());
if (ArchivoSeleccionado.exists()) {
LectorDeFormato = ManejadorDeFormatos.createReaderFor(ArchivoSeleccionado);
AbrirSource = std::make_unique<AudioFormatReaderSource>(LectorDeFormato, true);
MostrarNombreDelArchivo.setText(ArchivoSeleccionado.getFileName(), NotificationType::dontSendNotification);
MostrarDirectorioDelArchivo.setText(ArchivoSeleccionado.getFullPathName(), NotificationType::dontSendNotification);
FDM = LectorDeFormato->sampleRate;
PDB = LectorDeFormato->bitsPerSample;
FDA = LectorDeFormato->getFormatName();
NDC = LectorDeFormato->numChannels;
BR = FDM * PDB * NDC;
Transportador.setSource(AbrirSource.get());
ReproductorSource.reset(AbrirSource.release());
}
else
return File();
; });
}
This part is called through an ImageButton.onClick.
The object leak only occurs when I close the plugin in Cakewalk while debugging it, so I added this in the destructor:
ProyectoAudioProcessor::~ProyectoAudioProcessor()
{
LectorDeFormato = nullptr;
AbrirSource = nullptr;
SelectorDeArchivos = nullptr;
}
This didn´t work either :C
The error/leaked object message is this:
*** Leaked objects detected: 1 instance(s) of class AccessibilityNativeHandle
JUCE Assertion failure in juce_LeakedObjectDetector.h:92
Cakewalk.exe has unchained a point of interruption (I translated this part ´cause my VS is in Spanish jeje).
I tried the HeavyLeakedObjectDetector in the private of my Processor, but this didn´t worked either.
Anyone has any idea of what the solution could be or what´s going on?
Thanks!