Permalink
Browse files

fixed critical bug in shutdown()

  • Loading branch information...
1 parent bc411df commit 729c92d5d101855a92c4fda8a285d501cfd17c34 @Neverlord Neverlord committed Aug 22, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/singleton_manager.cpp
@@ -67,7 +67,10 @@ template<typename T>
void stop_and_kill(std::atomic<T*>& ptr) {
for (;;) {
auto p = ptr.load();
- if (ptr.compare_exchange_weak(p, nullptr)) {
+ if (p == nullptr) {
+ return;
+ }
+ else if (ptr.compare_exchange_weak(p, nullptr)) {
p->stop();
delete p;
ptr = nullptr;

0 comments on commit 729c92d

Please sign in to comment.