DRW: Fix memory leak with dupli objects.
This was caused by dupli's ObjectEngineData that were not free. This allocates the data using the instance data manager (no alloc/free between frames). Though the data should be treated as not persistent in this case.
This commit is contained in:
parent
8a2f93b2ab
commit
af425f3f7a
Notes:
blender-bot
2023-02-14 00:20:15 +01:00
Referenced by commit 42c99ee5f5
, DRW: Fix crash caused by fixing the leak (badly).
|
@ -2822,7 +2822,17 @@ ObjectEngineData *DRW_object_engine_data_ensure(
|
|||
return oed;
|
||||
}
|
||||
/* Allocate new data. */
|
||||
oed = MEM_callocN(size, "ObjectEngineData");
|
||||
if ((ob->base_flag & BASE_FROMDUPLI) != 0) {
|
||||
/* NOTE: data is not persistent in this case. It is reset each redraw. */
|
||||
/* Round to sizeof(float) for DRW_instance_data_request(). */
|
||||
const size_t t = sizeof(float) - 1;
|
||||
size = (size + t) & ~t;
|
||||
oed = (ObjectEngineData *)DRW_instance_data_request(DST.idatalist, size / sizeof(float), 16);
|
||||
memset(oed, 0, size);
|
||||
}
|
||||
else {
|
||||
oed = MEM_callocN(size, "ObjectEngineData");
|
||||
}
|
||||
oed->engine_type = engine_type;
|
||||
oed->free = free_cb;
|
||||
/* Perform user-side initialization, if needed. */
|
||||
|
|
Loading…
Reference in New Issue