Skip to content

Commit

Permalink
fixup! SDL fix memory leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sniukalov committed Jun 4, 2020
1 parent be4a738 commit ed572e6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/utils/src/threads/async_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,17 @@ void AsyncRunner::AsyncRunnerDelegate::waitForDelegate() {

void AsyncRunner::AsyncRunnerDelegate::clearDelegateQueue() {
if (!delegates_queue_.empty()) {
std::queue<threads::ThreadDelegate*> empty_queue;
std::queue<threads::ThreadDelegate*> queue_to_delete;
delegates_queue_lock_.Acquire();
std::swap(delegates_queue_, empty_queue);
std::swap(delegates_queue_, queue_to_delete);
delegates_queue_lock_.Release();
do {
auto delegate = empty_queue.front();
empty_queue.pop();
auto delegate = queue_to_delete.front();
queue_to_delete.pop();
if (delegate) {
delete delegate;
}
} while (!empty_queue.empty());
} while (!queue_to_delete.empty());
}
}

Expand Down

0 comments on commit ed572e6

Please sign in to comment.