summaryrefslogtreecommitdiff
path: root/modules/mono
diff options
context:
space:
mode:
authorIgnacio Roldán Etcheverry <neikeq@users.noreply.github.com>2022-09-03 23:12:36 +0200
committerGitHub <noreply@github.com>2022-09-03 23:12:36 +0200
commit8a928bf4655062132477c84f8b8d0f1326281b4b (patch)
tree6215ce4e04699da278db58b4223092270dd62355 /modules/mono
parent6c62ffe0209bf96e7279344cf3a3ffaa6c24a526 (diff)
parent281ccc7e1b12ee9292e8980d5d986b98bff8bb85 (diff)
Merge pull request #65296 from raulsntos/dotnet/signal-once
C#: Connect only once for each signal of a script
Diffstat (limited to 'modules/mono')
-rw-r--r--modules/mono/csharp_script.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 2e59987fe6..64792a795f 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -1754,20 +1754,16 @@ void CSharpInstance::mono_object_disposed_baseref(GCHandleIntPtr p_gchandle_to_f
}
void CSharpInstance::connect_event_signals() {
- CSharpScript *top = script.ptr();
- while (top != nullptr) {
- for (CSharpScript::EventSignalInfo &signal : top->get_script_event_signals()) {
- String signal_name = signal.name;
-
- // TODO: Use pooling for ManagedCallable instances.
- EventSignalCallable *event_signal_callable = memnew(EventSignalCallable(owner, signal_name));
+ // The script signals list includes the signals declared in base scripts.
+ for (CSharpScript::EventSignalInfo &signal : script->get_script_event_signals()) {
+ String signal_name = signal.name;
- Callable callable(event_signal_callable);
- connected_event_signals.push_back(callable);
- owner->connect(signal_name, callable);
- }
+ // TODO: Use pooling for ManagedCallable instances.
+ EventSignalCallable *event_signal_callable = memnew(EventSignalCallable(owner, signal_name));
- top = top->base_script.ptr();
+ Callable callable(event_signal_callable);
+ connected_event_signals.push_back(callable);
+ owner->connect(signal_name, callable);
}
}