HomeWildfire Games

Fix rP14372 and rP22666 miniupnpc leak and crash on thread exit.

Description

Fix rP14372 and rP22666 miniupnpc leak and crash on thread exit.

std::thread crashes when destroyed without being joined or detached.
Joining would wait on the UPnP thread, which can take upwards of 10 seconds, so detach instead.

Reviewed By: elexis

Differential Revision: https://code.wildfiregames.com/D2181

Event Timeline

elexis added a subscriber: elexis.Aug 16 2019, 8:01 PM

I tested again multiple times...
With the joinable() test there is no warning, without the condition there is!
Also says possible leak, not definite. So perhaps its testing the not impossible per se case that the thing was only default constructed.

9669== 480 bytes in 1 blocks are possibly lost in loss record 2,785 of 3,231

So it should be good without the TODO, false alert.

(So only imaginary TODO to have this joinable by having some other library that better supports getting shutdown.)