diff options
author | Sergey Sharybin <sergey@blender.org> | 2022-11-03 12:42:48 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2022-11-03 16:32:04 +0300 |
commit | 09b9e1e95ee4a5cea5297d06af26385b73856aeb (patch) | |
tree | 0e43d1bea069d6051e36debb1c5d86cdad910946 | |
parent | 666135c32af3032d1e6c62ee953d65f399da7d0f (diff) |
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
-rw-r--r-- | intern/guardedalloc/MEM_guardedalloc.h | 2 |
1 files changed, 1 insertions, 1 deletions
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<typename T, typename... Args> 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>(args)...); } |