facebookarchive / RakNet

RakNet is a cross platform, open source, C++ networking engine for game programmers.
Other
3.3k stars 1.02k forks source link

Fixed an issue where the NATCompleteServer example would crash on exit #91

Open noblewhale opened 8 years ago

noblewhale commented 8 years ago

Fixed an issue where the NATCompleteServer example would crash on exit due to trying to clean up samples that were never initialized.

Luke1410 commented 6 years ago

Thanks for bringing this up. I could reproduce the crash when either the CloudServer or the RelayPlugin samples are not enabled. However, in my opinion the issue is rather that the relayPlugin pointer (in RelayPluginFramework) and the cloudServer pointer (in the CloudServerFramework) are not initialized to null in the respective ctors. In other words: Calling shutdown on uninitialized samples shouldn't crash.

So while your change prevents the crash as well, I think it's better to cleanly initialize the pointers and keep the calls to samples[i]->Shutdown(rakPeer) unconditionally.

As said, thanks once more for pointing out the issue. The corresponding change is available in the SLikeNet master Git repository already and is expected to be shipped with SLikeNet 0.2.0 (internal case number: SLNET-192).

Since in principle you pointed out the issue and suggested a fix, we'd like to offer you an entry in the acknowledgment section of the accompanying readme file (due to lack of other means to contact you, posting this in this comment here). The entry would look like this:

Please let me know if that's fine with you (preferably by mail to info@slikesoft.com - or alternatively leave a comment here). Unless you explicitly say so, we won't put that entry in the readme file (to respect your privacy).

Luke1410 commented 6 years ago

Since we did an unplanned release of SLikeNet, we decided to incorporate this fix (aka: case SLNET-192) in SLikeNet 0.1.2 already which is available now on https://www.slikenet.com/ and on the GitHub project page: https://github.com/SLikeSoft/SLikeNet/releases/tag/v.0.1.2 .