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

Attempt to disconnect a nonexistent connection from '@ConfirmationDialog@16952:<ConfirmationDialog#1125499591109>'. Signal: 'confirmed', callable: 'Delegate::Invoke' (and similar) errors when closing editor after building C# project #76708

Open
RedworkDE opened this issue May 3, 2023 · 9 comments

Comments

@RedworkDE
Copy link
Member

RedworkDE commented May 3, 2023

Godot version

v4.1.dev2

System information

Windows

Issue description

Closing the editor after building a C# project prints these errors:

ERROR: Attempt to disconnect a nonexistent connection from '@ConfirmationDialog@16952:<ConfirmationDialog#1125499591109>'. Signal: 'confirmed', callable: 'Delegate::Invoke'.
   at: (core\object\object.cpp:1353)
ERROR: Attempt to disconnect a nonexistent connection from '<VBoxContainer#1125902244315>'. Signal: 'ready', callable: 'Delegate::Invoke'.
   at: (core\object\object.cpp:1353)
ERROR: Attempt to disconnect a nonexistent connection from '@Button@16961:<Button#1126405560822>'. Signal: 'pressed', callable: 'Delegate::Invoke'.
   at: (core\object\object.cpp:1353)
ERROR: Attempt to disconnect a nonexistent connection from '@PopupMenu@16960:<PopupMenu#1126036462051>'. Signal: 'id_pressed', callable: 'Delegate::Invoke'.
   at: (core\object\object.cpp:1353)
ERROR: Attempt to disconnect a nonexistent connection from '<EditorSettings#-9223372008903932771>'. Signal: 'settings_changed', callable: 'Delegate::Invoke'.
   at: (core\object\object.cpp:1353)

Causes and possible fixes

Reloading the managed assemblies causes the hash of ManagedCallable instances to change, corrupting the hash map of signals and causing these issues on cleanup.

#75533 prevents the GodotTools assembly from being reloaded and thus prevents these errors in particular, but these errors will still trigger when using custom editor plugins.

Steps to reproduce

  1. Take any C# project (the project must have the solution, but no C# code is required)
  2. Rebuild the solution
  3. Exit the editor

Minimal reproduction project

It's an empty project: Test_1.zip

@RedworkDE
Copy link
Member Author

  1. I found Update filesystem dock on script, scene, and resource creation #52189 (review) with the same symptoms but the discussion is just I'll open an issue, which apparently never actually happened
  2. The error message is wrong, the signal did not somehow stop existing, but I already fixed the mesasge and just forgot about it again Improve error message when disconnecting callable from signal it was not connected to #75465
  3. What appear to be happening is that on node deletion it tries to cleanup all its signals, but when for some reason disconnecting one fail it tries again and again forever.

@shana
Copy link
Contributor

shana commented May 3, 2023

I've had this happen as well, and at the end it crashed with a stack overflow iirc, so it might be getting into a circular dependency cleanup loop, fwiw.

@RedworkDE
Copy link
Member Author

#73904 introduced the use of the signal but that did not cause the issue.

What appears to happen is that when assemblies are rebuilt, they also have to be reloaded, which means that the delegate type for the lambda the connects to the signal changes. Now because the hash of a ManagedCallable is based on that it changes when assemblies are reloaded, corrupting the hashmap used to store signals and the callable can no longer be retrieved.

This is only an issue since #72421 since previously signals where stored in a VMap (a sorted dictionary) and the hash was not used. (Tho looking at the less than implementation I am pretty sure that it doesn't really work correctly either and that similar situations where an equal, tho not the same c++ object, callable could not be found in the ap)

@RedworkDE
Copy link
Member Author

Also I actually already fixed the hash of that particular Callable changing in #75533, but that does not fix the issue in general.

@akien-mga
Copy link
Member

For me in 4.1 dev 2, it raises these errors, but doesn't spam infinitely:

ERROR: Disconnecting nonexistent signal 'confirmed', callable: Delegate::Invoke.
   at: _disconnect (core/object/object.cpp:1340)
ERROR: Disconnecting nonexistent signal 'ready', callable: Delegate::Invoke.
   at: _disconnect (core/object/object.cpp:1340)
ERROR: Disconnecting nonexistent signal 'pressed', callable: Delegate::Invoke.
   at: _disconnect (core/object/object.cpp:1340)
ERROR: Disconnecting nonexistent signal 'id_pressed', callable: Delegate::Invoke.
   at: _disconnect (core/object/object.cpp:1340)
ERROR: Disconnecting nonexistent signal 'settings_changed', callable: Delegate::Invoke.
   at: _disconnect (core/object/object.cpp:1340)
ERROR: Condition "!EditorSettings::get_singleton() || !EditorSettings::get_singleton()->has_setting(p_setting)" is true. Returning: Variant()
   at: _EDITOR_GET (editor/editor_settings.cpp:1110)

@RedworkDE RedworkDE changed the title Disconnecting nonexistent signal 'confirmed', callable: Delegate::Invoke Error spam when closing editor after building C# project Disconnecting nonexistent signal 'confirmed', callable: Delegate::Invoke (and similar) errors when closing editor after building C# project May 15, 2023
@RedworkDE RedworkDE changed the title Disconnecting nonexistent signal 'confirmed', callable: Delegate::Invoke (and similar) errors when closing editor after building C# project Attempt to disconnect a nonexistent connection from '@ConfirmationDialog@16952:<ConfirmationDialog#1125499591109>'. Signal: 'confirmed', callable: 'Delegate::Invoke' (and similar) errors when closing editor after building C# project May 25, 2023
@YuriSizov YuriSizov modified the milestones: 4.1, 4.2 Jun 23, 2023
@YuriSizov
Copy link
Contributor

Is this still an issue in 4.2? There used to be some problems with how dialogs were handled around build errors and whatnot, maybe this was related and so is now fixed?

@YuriSizov YuriSizov modified the milestones: 4.2, 4.3 Nov 14, 2023
@raulsntos
Copy link
Member

This issue is caused by signals (specifically the ManagedCallable we use when connecting to signals in C#), not really related to dialogs, and the error message in the original post shows other occurrences with other non-dialog types.

I think the issue reported originally was fixed by #75533 and #77199, but the general issue should still exist (e.g.: when using custom editor plugins). It needs a new MRP though.

@paulloz
Copy link
Member

paulloz commented Dec 6, 2023

I think the issue reported originally was fixed by #75533 and #77199, but the general issue should still exist (e.g.: when using custom editor plugins). It needs a new MRP though.

Can confirm. I have this issue easily reproducible with my own plugin. It's going to be quite easy to make an MRP from there.

Edit: I spoke a bit too soon. It's proving difficult to replicate what I thought the issue was, outside my plugin.

@germanbv
Copy link

germanbv commented Jan 13, 2024

On my project this triggers after closing the editor only if I had connected a signal to the following C# custom RichTextEffect:

[GlobalClass]
[Tool]
public partial class BBCodeWaitCS : RichTextEffect
{	
    [Signal] 
    public delegate void WaitFinishedEventHandler();

I connect the signal via script using:

bbcodeWait.Connect("WaitFinished", Callable.From(showOptions));

then I get this after closing the editor:
ERROR: Attempt to disconnect a nonexistent connection from '<RichTextEffect#-9223370230552527345>'. Signal: 'WaitFinished', callable: 'Delegate::Invoke'.

EDIT: I'm on 4.2.1

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

9 participants