Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-01-07 08:32:01 +0300
committerCampbell Barton <campbell@blender.org>2022-01-07 09:48:54 +0300
commitf24854005d8688fb86cf41bd62a63580c63f818d (patch)
tree2c348e4453a199ebb54db26dba3db8ed1bce5526 /source/blender/editors/space_api
parent164202831032164ed52108b4a365b9ff9ca4ac84 (diff)
Fix T94708: negative reference count error with Python API callbacks
Regression in 7972785d7b90771f50534fe3e1101d8adb615fa3 that caused Python callback arguments to be de-referenced twice - potentially accessing freed memory. Making a new-file with a circle-select tool active triggered this (for example). Now arguments aren't de-referenced when Blender it's self has already removed the callback handle.
Diffstat (limited to 'source/blender/editors/space_api')
-rw-r--r--source/blender/editors/space_api/spacetypes.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index 93d023c8bb4..f8adba30547 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -248,15 +248,16 @@ void *ED_region_draw_cb_activate(ARegionType *art,
return rdc;
}
-void ED_region_draw_cb_exit(ARegionType *art, void *handle)
+bool ED_region_draw_cb_exit(ARegionType *art, void *handle)
{
LISTBASE_FOREACH (RegionDrawCB *, rdc, &art->drawcalls) {
if (rdc == (RegionDrawCB *)handle) {
BLI_remlink(&art->drawcalls, rdc);
MEM_freeN(rdc);
- return;
+ return true;
}
}
+ return false;
}
static void ed_region_draw_cb_draw(const bContext *C, ARegion *region, ARegionType *art, int type)