This is a posible fix for #5655, on top of @Itms 's SM52 branch.
While running SM52 in debug mode, it triggered compartment failures. Indeed, it seems XMPP is initialised with a ScriptInterface that:
- Possibly no longer exists by the time the user changed to the lobby page
- isn't the same as the scriptInterface calling "guiPollNewMessages".
I couldn't reproduce the crash using P221 with this fix applied.
This needs to be cleaned up a little bit, obviously.