Skip to content

Commit

Permalink
fixed critical bug in shutdown()
Browse files Browse the repository at this point in the history
  • Loading branch information
Neverlord committed Aug 22, 2012
1 parent bc411df commit 729c92d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/singleton_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 729c92d

Please sign in to comment.