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

Autoload signal connected through C# delegate does not disconnect when receiver is freed #82346

Closed
chaseberry opened this issue Sep 26, 2023 · 2 comments

Comments

@chaseberry
Copy link

Godot version

v4.1.1.stable.mono.official.bd6af8e0e

System information

Windows 10.0.19045 - Vulkan (Mobile) - dedicated NVIDIA GeForce GTX 970 (NVIDIA; 31.0.15.3623) - Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz (8 Threads)

Issue description

When a node connects to a Signal created in an Autoload through C#s EventHandler, it continues to receive that signal after it has been freed. This can cause unintended behavior and ObjectDisposedExceptions.

The signal is disconnected when the 'Connect' function is used with a Callable.

#66319 is very related, and a possible jumping off point, although it was fixed a year ago.

Steps to reproduce

Create a signal in a script that is used in an Autoload.
Have a condition in the same Autoload script to emit the signal.
In another script, use C#s += to connect the signal to a function.
Free the second script.
Repeat the condition in the Autoload that emits the signal.

Minimal reproduction project

Run the included SignalTest project from Scene 1.
Click anywhere, three signal debugs should print.
Press enter to change to another scene.
Click anywhere, no signal debugs should print, but one does.

SignalTest.zip

@Wagnard
Copy link

Wagnard commented Oct 8, 2023

I can observe the same issue on my side.

@paulloz
Copy link
Member

paulloz commented Oct 8, 2023

Duplicate of #70414

@raulsntos raulsntos closed this as not planned Won't fix, can't repro, duplicate, stale Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants