Memory: Fix #705: don't use pool object after invoking destructor.
This commit is contained in:
parent
fd1d07daf1
commit
1cf2b35529
@ -201,15 +201,15 @@ void TPoolAllocator::pop()
|
|||||||
currentPageOffset = stack.back().offset;
|
currentPageOffset = stack.back().offset;
|
||||||
|
|
||||||
while (inUseList != page) {
|
while (inUseList != page) {
|
||||||
// invoke destructor to free allocation list
|
|
||||||
inUseList->~tHeader();
|
|
||||||
|
|
||||||
tHeader* nextInUse = inUseList->nextPage;
|
tHeader* nextInUse = inUseList->nextPage;
|
||||||
if (inUseList->pageCount > 1)
|
if (inUseList->pageCount > 1) {
|
||||||
|
inUseList->~tHeader(); // currently, just a debug allocation checker
|
||||||
delete [] reinterpret_cast<char*>(inUseList);
|
delete [] reinterpret_cast<char*>(inUseList);
|
||||||
else {
|
} else {
|
||||||
inUseList->nextPage = freeList;
|
inUseList->nextPage = freeList;
|
||||||
freeList = inUseList;
|
freeList = inUseList;
|
||||||
|
// inUseList->~tHeader(); TODO: this should probably call the allocation checker, but not the destructor
|
||||||
|
// ...if the destructor actually overwrites nextPage, that would effect freeList->nextPage
|
||||||
}
|
}
|
||||||
inUseList = nextInUse;
|
inUseList = nextInUse;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user