Stamp info: Use dedicated function to free up memory
This way it's more flexible to extend StampData structure with additional stuff which might require memory free.
This commit is contained in:
@@ -70,6 +70,7 @@ void BKE_render_result_stamp_info(struct Scene *scene, struct Object *camera,
|
||||
void BKE_imbuf_stamp_info(struct RenderResult *rr, struct ImBuf *ibuf);
|
||||
void BKE_stamp_info_from_imbuf(struct RenderResult *rr, struct ImBuf *ibuf);
|
||||
void BKE_stamp_info_callback(void *data, struct StampData *stamp_data, StampCallback callback, bool noskip);
|
||||
void BKE_stamp_data_free(struct StampData *stamp_data);
|
||||
void BKE_image_stamp_buf(
|
||||
struct Scene *scene, struct Object *camera, const struct StampData *stamp_data_template,
|
||||
unsigned char *rect, float *rectf, int width, int height, int channels);
|
||||
|
||||
@@ -2124,6 +2124,14 @@ void BKE_stamp_info_callback(void *data, struct StampData *stamp_data, StampCall
|
||||
#undef CALL
|
||||
}
|
||||
|
||||
void BKE_stamp_data_free(struct StampData *stamp_data)
|
||||
{
|
||||
if (stamp_data == NULL) {
|
||||
return;
|
||||
}
|
||||
MEM_freeN(stamp_data);
|
||||
}
|
||||
|
||||
/* wrap for callback only */
|
||||
static void metadata_change_field(void *data, const char *propname, char *propvalue, int UNUSED(len))
|
||||
{
|
||||
|
||||
@@ -116,8 +116,8 @@ void render_result_free(RenderResult *res)
|
||||
MEM_freeN(res->text);
|
||||
if (res->error)
|
||||
MEM_freeN(res->error);
|
||||
if (res->stamp_data)
|
||||
MEM_freeN(res->stamp_data);
|
||||
|
||||
BKE_stamp_data_free(res->stamp_data);
|
||||
|
||||
MEM_freeN(res);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user