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:
Diffstat (limited to 'source/blender/editors/interface/interface.c')
-rw-r--r--source/blender/editors/interface/interface.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index fd75be5b847..ebfc3f307cb 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -88,8 +88,27 @@
#include "DEG_depsgraph_query.h"
+#include "BLI_asan.h"
#include "interface_intern.h"
+void poison_ui_but(struct uiBut *but)
+{
+ BLI_asan_poison(but->poison1, sizeof(but->poison1));
+ BLI_asan_poison(but->poison2, sizeof(but->poison2));
+ BLI_asan_poison(but->poison3, sizeof(but->poison3));
+ BLI_asan_poison(but->poison4, sizeof(but->poison4));
+ BLI_asan_poison(but->poison5, sizeof(but->poison5));
+}
+
+void unpoison_ui_but(struct uiBut *but)
+{
+ BLI_asan_unpoison(but->poison1, sizeof(but->poison1));
+ BLI_asan_unpoison(but->poison2, sizeof(but->poison2));
+ BLI_asan_unpoison(but->poison3, sizeof(but->poison3));
+ BLI_asan_unpoison(but->poison4, sizeof(but->poison4));
+ BLI_asan_unpoison(but->poison5, sizeof(but->poison5));
+}
+
/* prototypes. */
static void ui_but_to_pixelrect(struct rcti *rect,
const struct ARegion *region,
@@ -3370,9 +3389,16 @@ static void ui_but_free_type_specific(uiBut *but)
}
}
+#include "BLI_compiler_attrs.h"
+#include "BLI_threads.h"
+
/* can be called with C==NULL */
static void ui_but_free(const bContext *C, uiBut *but)
{
+ if (!BLI_thread_is_main()) {
+ printf("Evil!\n");
+ }
+
if (but->opptr) {
WM_operator_properties_free(but->opptr);
MEM_freeN(but->opptr);
@@ -3420,6 +3446,7 @@ static void ui_but_free(const bContext *C, uiBut *but)
BLI_assert(UI_butstore_is_registered(but->block, but) == false);
+ unpoison_ui_but(but);
MEM_freeN(but);
}
@@ -3966,7 +3993,11 @@ static uiBut *ui_but_alloc(const eButType type)
const char *alloc_str;
ui_but_alloc_info(type, &alloc_size, &alloc_str, NULL);
- return MEM_callocN(alloc_size, alloc_str);
+ uiBut *ret = MEM_callocN(alloc_size, alloc_str);
+
+ poison_ui_but(ret);
+
+ return ret;
}
/**
@@ -4000,7 +4031,10 @@ uiBut *ui_but_change_type(uiBut *but, eButType new_type)
const bool has_str_ptr_to_self = but->str == but->strdata;
const bool has_poin_ptr_to_self = but->poin == (char *)but;
+ unpoison_ui_but(but);
but = MEM_recallocN_id(but, alloc_size, alloc_str);
+ poison_ui_but(but);
+
but->type = new_type;
if (has_str_ptr_to_self) {
but->str = but->strdata;