Skip to content

Commit 5a462e9

Browse files
committed
[godot] Closes #2516, memdelete instead of memfree on Control
1 parent 77f48a3 commit 5a462e9

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

spine-godot/build/debug.plist

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>com.apple.security.get-task-allow</key><true/></dict></plist>

spine-godot/build/sign.sh

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
codesign -s - -v -f --entitlements build/debug.plist godot/bin/godot.macos.editor.dev.arm64

spine-godot/spine_godot/SpineSprite.cpp

+10-8
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "SpineSkeleton.h"
3434
#include "SpineRendererObject.h"
3535
#include "SpineSlotNode.h"
36+
#include "core/os/memory.h"
3637

3738
#if VERSION_MAJOR > 3
3839
#include "core/config/engine.h"
@@ -1047,14 +1048,6 @@ void SpineSprite::draw() {
10471048
}
10481049

10491050
#if TOOLS_ENABLED
1050-
Ref<Font> default_font;
1051-
auto control = memnew(Control);
1052-
#if VERSION_MAJOR > 3
1053-
default_font = control->get_theme_default_font();
1054-
#else
1055-
default_font = control->get_font(SNAME("font"), SNAME("Label"));
1056-
#endif
1057-
memfree(control);
10581051

10591052
float editor_scale = EditorInterface::get_singleton()->get_editor_scale();
10601053
float inverse_zoom = 1 / get_viewport()->get_global_canvas_transform().get_scale().x * editor_scale;
@@ -1074,6 +1067,15 @@ void SpineSprite::draw() {
10741067
auto global_scale = get_global_scale();
10751068
draw_set_transform(mouse_position + Vector2(20, 0), -get_global_rotation(), Vector2(inverse_zoom * (1 / global_scale.x), inverse_zoom * (1 / global_scale.y)));
10761069

1070+
Ref<Font> default_font;
1071+
auto control = memnew(Control);
1072+
#if VERSION_MAJOR > 3
1073+
default_font = control->get_theme_default_font();
1074+
#else
1075+
default_font = control->get_font(SNAME("font"), SNAME("Label"));
1076+
#endif
1077+
memdelete(control);
1078+
10771079
#if VERSION_MAJOR > 3
10781080
float line_height = default_font->get_height(Font::DEFAULT_FONT_SIZE) + default_font->get_descent(Font::DEFAULT_FONT_SIZE);
10791081
#else

0 commit comments

Comments
 (0)