From 7972785d7b90771f50534fe3e1101d8adb615fa3 Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Wed, 24 Feb 2021 11:57:29 -0300 Subject: PyAPI: Fix memory leak of parameters used for python 'draw_callbacks' When closing the blender, while the callbacks are removed, the reference count of the object used as `customdata` is not decremented. This commit adds two functions that correctly release the python `draw_callbacks` before releasing all `draw_callbacks`. Differential Revision: https://developer.blender.org/D10478 --- source/blender/blenkernel/intern/screen.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/blender/blenkernel/intern/screen.c') diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index 80a83aecea8..df239b0c4ee 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -65,6 +65,10 @@ #include "BLO_read_write.h" +#ifdef WITH_PYTHON +# include "BPY_extern.h" +#endif + static void screen_free_data(ID *id) { bScreen *screen = (bScreen *)id; @@ -328,6 +332,9 @@ static ListBase spacetypes = {NULL, NULL}; static void spacetype_free(SpaceType *st) { LISTBASE_FOREACH (ARegionType *, art, &st->regiontypes) { +#ifdef WITH_PYTHON + BPY_callback_screen_free(art); +#endif BLI_freelistN(&art->drawcalls); LISTBASE_FOREACH (PanelType *, pt, &art->paneltypes) { -- cgit v1.2.3