Closed TonyAlbrecht closed 2 years ago
Thank you for the report. Should be easy enough to fix.
Which version of NetImgui are you using?
Issue has been fixed: 74d0be3fc704d5d723c6d704a0d77233af59c40d
Normally, the hook cleanup happen in NewFrame()
. As long as it is always called, there should not be any problem. Once I tried with the 'NoBackend' sample (only draw where there's an active connection) , I was able to reproduce the issue and fix it accordingly.
Hey Sammy, I love what you've done with netImgui, but I think I've found a bug.
Whenever
ConnectFromApp()
is called, itDisconnects()
and then reconnects and callsclient.ContextInitialize()
which adds a new context hook (if NETIMGUI_IMGUI_CALLBACK_ENABLED is defined). Currently, the Disconnect doesn't remove the hook, so we end up with a new hook being added every timeConnectFromApp()
is called.You can repro this by running a client, connecting to a server then shutting the server down and then starting it and reconnecting. Every time you do this, a new hook is added and the result is that the server only displays a valid update once every 'N' frames.
Checking
mhImguiHookNewframe
inContextInitialize()
and only adding a new hook if it's zero works, as should removing the hook in Disconnect() (currently the destructor for ClientInfo is the only place that removes the hook.)