1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-03 11:50:27 +00:00

Fix memnew_placement with char * arguments. Before, it would call the description version, allocating on the heap instead of ni the given memory.

This commit is contained in:
Lukas Tenbrink
2025-10-25 17:26:37 +02:00
parent ab6c6eece8
commit 65bf516006

View File

@@ -95,6 +95,10 @@ public:
_FORCE_INLINE_ static void free(void *p_ptr) { Memory::free_static(p_ptr, false); }
};
// Works around an issue where memnew_placement (char *) would call the p_description version.
inline void *operator new(size_t p_size, char *p_dest) {
return operator new(p_size, (void *)p_dest);
}
void *operator new(size_t p_size, const char *p_description); ///< operator new that takes a description and uses MemoryStaticPool
void *operator new(size_t p_size, void *(*p_allocfunc)(size_t p_size)); ///< operator new that takes a description and uses MemoryStaticPool