Fix destruction code in ChoppedVector.
This commit is contained in:
parent
406367b6c6
commit
4d8d08b27d
|
@ -39,6 +39,8 @@ void freeT(T)(ref T inst) @nogc
|
||||||
{
|
{
|
||||||
import core.stdc.stdlib : free;
|
import core.stdc.stdlib : free;
|
||||||
|
|
||||||
|
if (!inst) return;
|
||||||
|
|
||||||
noGCDestroy(inst);
|
noGCDestroy(inst);
|
||||||
static if (hasIndirections!T)
|
static if (hasIndirections!T)
|
||||||
GC.removeRange(cast(void*)inst);
|
GC.removeRange(cast(void*)inst);
|
||||||
|
@ -151,12 +153,13 @@ struct ChoppedVector(T, size_t CHUNK_SIZE = 16*64*1024/nextPOT(T.sizeof)) {
|
||||||
@nogc {
|
@nogc {
|
||||||
() @trusted {
|
() @trusted {
|
||||||
foreach (i; 0 .. m_chunkCount) {
|
foreach (i; 0 .. m_chunkCount) {
|
||||||
destroy(m_chunks[i]);
|
destroy(*m_chunks[i]);
|
||||||
static if (hasIndirections!T)
|
static if (hasIndirections!T)
|
||||||
GC.removeRange(m_chunks[i]);
|
GC.removeRange(m_chunks[i]);
|
||||||
free(m_chunks[i]);
|
free(m_chunks[i]);
|
||||||
}
|
}
|
||||||
free(m_chunks.ptr);
|
free(m_chunks.ptr);
|
||||||
|
m_chunks = null;
|
||||||
} ();
|
} ();
|
||||||
m_chunkCount = 0;
|
m_chunkCount = 0;
|
||||||
m_length = 0;
|
m_length = 0;
|
||||||
|
|
Loading…
Reference in a new issue