MemoryBlock assertion


#1

This happens everytime i create a MemoryBlock and try to return it as a copy from a function:

MemoryBlock::~MemoryBlock() noexcept
{
    jassert (size >= 0);    // should never happen
    jassert (size == 0 || data != nullptr); // non-zero size but no data allocated? <-- THIS HAPPENS
}

but for example this also happens when i do:

BigInteger bi;
r.fillBitsRandomly(bi, 0, 64);
MD5 md5(bi.toMemoryBlock());

Is there something i’m missing ?


#2

Ah! You must be using a C++11 compiler! Don’t worry, the assertion is harmless, but is being triggered because my move constructor doesn’t fully clear-up the old object. I’ll sort that out right away, thanks!