Fix a few GC bugs.
Adding a to a symbol table can trigger a GC, so we need to make sure we don't do that while sitting on an unpinned object.
This commit is contained in:
+2
-4
@@ -324,10 +324,8 @@ static void writeBuffer(WrenVM* vm, Buffer* buffer, uint8_t byte)
|
||||
|
||||
static void freeBuffer(WrenVM* vm, Buffer* buffer)
|
||||
{
|
||||
wrenReallocate(vm, buffer->bytes, buffer->capacity, 0);
|
||||
buffer->bytes = NULL;
|
||||
buffer->capacity = 0;
|
||||
buffer->length = 0;
|
||||
wrenReallocate(vm, buffer->bytes, 0, 0);
|
||||
initBuffer(vm, buffer);
|
||||
}
|
||||
|
||||
// Initializes [compiler].
|
||||
|
||||
Reference in New Issue
Block a user