Fix T61035 Draw manager crash opening file with curves
Move free callback call to GPU_batch_discard to prevent the crash. The issue was that clearing can happen after referencing to an instance buffer and that's perfectly legal.
This commit is contained in:
@@ -120,10 +120,6 @@ void GPU_batch_copy(GPUBatch *batch_dst, GPUBatch *batch_src)
|
||||
|
||||
void GPU_batch_clear(GPUBatch *batch)
|
||||
{
|
||||
if (batch->free_callback) {
|
||||
batch->free_callback(batch, batch->callback_data);
|
||||
}
|
||||
|
||||
if (batch->owns_flag & GPU_BATCH_OWNS_INDEX) {
|
||||
GPU_indexbuf_discard(batch->elem);
|
||||
}
|
||||
@@ -145,6 +141,10 @@ void GPU_batch_clear(GPUBatch *batch)
|
||||
|
||||
void GPU_batch_discard(GPUBatch *batch)
|
||||
{
|
||||
if (batch->free_callback) {
|
||||
batch->free_callback(batch, batch->callback_data);
|
||||
}
|
||||
|
||||
GPU_batch_clear(batch);
|
||||
MEM_freeN(batch);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user