Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use free() as Callable #86706

Closed
KoBeWi opened this issue Jan 2, 2024 · 4 comments · Fixed by #87294
Closed

Can't use free() as Callable #86706

KoBeWi opened this issue Jan 2, 2024 · 4 comments · Fixed by #87294

Comments

@KoBeWi
Copy link
Member

KoBeWi commented Jan 2, 2024

Tested versions

Confirmed in 4.2, but likely applies to all current 4.x versions

System information

Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 (NVIDIA; 30.0.15.1403) - Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 Threads)

Issue description

When trying to use free() as a Callable (e.g. for connecting signal or using call_deferred()), it fails with Parser Error: Identifier not found: free, but only at runtime.

Steps to reproduce

func _ready():
	free.call_deferred()
  1. Run.

Minimal reproduction project (MRP)

N/A

@akien-mga
Copy link
Member

akien-mga commented Jan 2, 2024

Related to #82251, and duplicate of #58912 (but closed after adding docs).
Should be fixed by #82264. If you want to test/review it, could use another pair of eyes before merging for 4.3.

@KoBeWi
Copy link
Member Author

KoBeWi commented Jan 2, 2024

Hmm I knew it was reported before, but couldn't find it 🤔
It's a bug though, because the error appears only at runtime.

@KoBeWi
Copy link
Member Author

KoBeWi commented Jan 2, 2024

#82264 does not fix it.

@dalexeev
Copy link
Member

dalexeev commented Jan 2, 2024

#82264 is about methods of Variant types, free() is an Object method. I'm guessing the reason is that Object.free() is bound in a special way:

ClassDB::add_virtual_method("Object", MethodInfo("free"), false);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants