Hello guys, I spent all day solving some leaks in my plugin and it was everything ok until now.
This seems to be the last one leak that I have and I dont know what else I can do to solve it.
I´m getting this leak detected when removing my plugin from the host.
Leaked objects detected: 1 instance(s) of class MemoryInputStream
and bellow is the code I´m using MemoryInputStream class:
void OBNetwork::requestZipKit()
{
auto url = OBPathHelper::getZipUrl(_workingKit.name);
MemoryBlock memoryBlock;
if (url.readEntireBinaryStream(memoryBlock))
{
MemoryInputStream memStream(memoryBlock, false);
auto _zipFile = std::unique_ptr<ZipFile>(new ZipFile(&memStream, true));
if (_callbackDownloadFinished)
_callbackDownloadFinished(true, std::move(_zipFile));
}
else
{
if (_callbackDownloadFinished)
_callbackDownloadFinished(false, nullptr);
}
}
Thanks in advance.
[SOLVED]
It was a dumb mistake and solved not passing the ownership to the zipfile class in the second parameter:
auto _zipFile = std::unique_ptr(new ZipFile(&memStream, false ));
Thanks cpr2323.
