From 09b9e1e95ee4a5cea5297d06af26385b73856aeb Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 3 Nov 2022 10:42:48 +0100 Subject: Fix T102225: Crash opening menus Seems to be introduced by 99e5024e97f. The crash is caused by the difference in the expected alignment of the `uiPopupMenu` which is 16 bytes and the actual alignment returned by the `MEM_mallocN()` which is 8 bytes due to the memory head. Now made it so that `MEM_new()` can be used for types with any alignment. Differential Revision: https://developer.blender.org/D16375 --- intern/guardedalloc/MEM_guardedalloc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'intern') diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h index fdd77fb9eef..5ae33343949 100644 --- a/intern/guardedalloc/MEM_guardedalloc.h +++ b/intern/guardedalloc/MEM_guardedalloc.h @@ -271,7 +271,7 @@ void MEM_use_guarded_allocator(void); template inline T *MEM_new(const char *allocation_name, Args &&...args) { - void *buffer = MEM_mallocN(sizeof(T), allocation_name); + void *buffer = MEM_mallocN_aligned(sizeof(T), alignof(T), allocation_name); return new (buffer) T(std::forward(args)...); } -- cgit v1.2.3