diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2021-02-24 17:57:29 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2021-02-24 17:57:29 +0300 |
commit | 7972785d7b90771f50534fe3e1101d8adb615fa3 (patch) | |
tree | 0880e1531a3809d6c1ec26eda638c22659b4fe73 /source/blender/blenkernel/intern/screen.c | |
parent | 6b6469a2e552e1454cb09987d931cc5e72a99fdf (diff) |
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
Diffstat (limited to 'source/blender/blenkernel/intern/screen.c')
-rw-r--r-- | source/blender/blenkernel/intern/screen.c | 7 |
1 files changed, 7 insertions, 0 deletions
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) { |