godot icon indicating copy to clipboard operation
godot copied to clipboard

Fix ptrcalls to static GDExtension methods

Open dsnopek opened this issue 9 months ago • 1 comments

This was noticed during a short discussion on RocketChat.

GDScript is apparently never making any validated calls to static methods, which has meant that this bug hasn't been triggered up until now.

However, if anything were to make a validated call or ptrcall to a static GDExtension method it would have segfaulted.

This PR should fix that!

dsnopek avatar Apr 25 '24 12:04 dsnopek

After thinking about this code for a little bit, I decided to sneak one tiny additional thing in here. It was sort of silly that validated_call() was calling into ptrcall(), which has just one line of functional code, aside from the ERR_*() macros and getting the extension instance, all of which we've already done in validated_call(). So, I copied that one line up into validated_call() itself. This will likely be a very minor performance improvement.

dsnopek avatar Apr 25 '24 13:04 dsnopek

Thanks!

akien-mga avatar Apr 25 '24 15:04 akien-mga