Skip to content

Ensure frame_post_draw signal disconnect properly#39

Merged
unvermuthet merged 2 commits intounvermuthet:mainfrom
cyberpsyche:fix/frame_post_draw
Dec 27, 2025
Merged

Ensure frame_post_draw signal disconnect properly#39
unvermuthet merged 2 commits intounvermuthet:mainfrom
cyberpsyche:fix/frame_post_draw

Conversation

@cyberpsyche
Copy link
Contributor

When one switch godot scene from one to another, the godot engine will get error message for "Attempt to disconnect a nonexistent connection from RenderingServer Signal: 'frame_post_draw'". My PR is trying to resolve this problem.

Copy link
Owner

@unvermuthet unvermuthet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment on lines +22 to +23
// Ensure the disconnection from the frame_post_draw signal if it's connected
SIGNAL_DISCONNECT(RenderingServer::get_singleton(), "frame_post_draw", callable_mp(this, &ViewportTextureRouter::request_textures));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit nervous about this. The ViewportTextureRouter is a core-level engine singleton. This basically lives as long as the whole engine, so I don't see a practical reason. I think by the time this is called, all NDIOutputs should be gone. And so, the last viewport will have been removed, and the signal will have been disconnected. I guess the only way this causes harm is if the RenderingServer is already gone when this is called. Did you test the impact? Any console errors when closing the editor or game? If this isn't part of fixing the error from #38, I'd prefer to leave it as is.

Comment on lines -49 to +53
RenderingServer::get_singleton()->disconnect("frame_post_draw", callable_mp(this, &ViewportTextureRouter::request_textures));
// RenderingServer::get_singleton()->disconnect("frame_post_draw", callable_mp(this, &ViewportTextureRouter::request_textures));
SIGNAL_DISCONNECT(RenderingServer::get_singleton(), "frame_post_draw", callable_mp(this, &ViewportTextureRouter::request_textures));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect! Could you remove the old commented-out line?

@cyberpsyche
Copy link
Contributor Author

I've removed the commented-out line in the code of viewport_texture_router.cpp. I've tested the code and it will resolve the problem of showing the error message in the console. There is no "Attempt to disconnect a nonexistent connection from RenderingServer Signal: 'frame_post_draw'" now.

@unvermuthet unvermuthet merged commit 17e5aea into unvermuthet:main Dec 27, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Attempt to disconnect a nonexistent connection from RenderingServer Signal: 'frame_post_draw'

2 participants