Merge pull request #102837 from raulsntos/dotnet/fix-reload-callables

[.NET] Skip serializing delegates with a disposed target
This commit is contained in:
Rémi Verschelde 2025-06-13 15:53:33 +02:00
commit 7e9b709917
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 14 additions and 2 deletions

View file

@ -685,8 +685,14 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
if (success) {
ManagedCallable::instances_pending_reload.insert(managed_callable, serialized_data);
} else if (OS::get_singleton()->is_stdout_verbose()) {
OS::get_singleton()->print("Failed to serialize delegate\n");
} else {
if (OS::get_singleton()->is_stdout_verbose()) {
OS::get_singleton()->print("Failed to serialize delegate.\n");
}
// We failed to serialize the delegate but we still have to release it;
// otherwise, we won't be able to unload the assembly.
managed_callable->release_delegate_handle();
}
}
}