wxSharedPtr::Release is not thread safe
|Reported by:||plorkyeran||Owned by:||vadz|
wxSharedPtr::Release uses wxAtomicDec, but it ignores the return value and does a separate read of the reference count afterwards. This can result in multiple threads seeing the ref count at zero and trying to delete the value. The fix is simply to use the return value of wxAtomicDec, which will only be 0 on one of the threads.