Ensure frame_post_draw signal disconnect properly#39
Ensure frame_post_draw signal disconnect properly#39unvermuthet merged 2 commits intounvermuthet:mainfrom
Conversation
| // 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)); |
There was a problem hiding this comment.
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.
| 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)); |
There was a problem hiding this comment.
Perfect! Could you remove the old commented-out line?
|
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. |
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.