mirror of
https://github.com/blender/blender
synced 2026-10-25 03:07:01 +03:00
ThorVG defines the global `operator new`, `operator delete`, and their array variants, forwarding to `malloc` and `free`. When the library is linked statically, this replaces allocation functions for all C++ code in Blender, not just ThorVG. Among other differences, the replacement returns null on failure instead of throwing, ignores `std::new_handler`, and hides new/delete mismatches from ASan. Unfortunately it seems upstream declined to make this optional (see https://github.com/thorvg/thorvg/issues/4153). Godot applies the same patch to its bundled copy: https://github.com/godotengine/godot/blob/master/thirdparty/thorvg/patches/0001-let-delete-be-delete.patch Pull Request: https://projects.blender.org/blender/blender/pulls/165153
43 lines
764 B
Diff
43 lines
764 B
Diff
--- a/src/common/tvgCommon.h
|
|
+++ b/src/common/tvgCommon.h
|
|
@@ -67,9 +67,6 @@
|
|
#define strncpy strncpy_s
|
|
#endif
|
|
|
|
-void* operator new(std::size_t size);
|
|
-void operator delete(void* ptr) noexcept;
|
|
-
|
|
namespace tvg {
|
|
|
|
enum class FileType { Png = 0, Jpg, Webp, Svg, Lot, Ttf, Raw, Gif, Unknown };
|
|
--- a/src/renderer/tvgInitializer.cpp
|
|
+++ b/src/renderer/tvgInitializer.cpp
|
|
@@ -131,27 +131,3 @@
|
|
{
|
|
return _version;
|
|
}
|
|
-
|
|
-
|
|
-void* operator new(std::size_t size)
|
|
-{
|
|
- return tvg::malloc(size);
|
|
-}
|
|
-
|
|
-
|
|
-void operator delete(void* ptr) noexcept
|
|
-{
|
|
- tvg::free(ptr);
|
|
-}
|
|
-
|
|
-
|
|
-void* operator new[](std::size_t size)
|
|
-{
|
|
- return tvg::malloc(size);
|
|
-}
|
|
-
|
|
-
|
|
-void operator delete[](void* ptr) noexcept
|
|
-{
|
|
- tvg::free(ptr);
|
|
-}
|
|
\ No newline at end of file
|