From 398f83735ae9c087774af4894a794510a1e375c0 Mon Sep 17 00:00:00 2001 From: Steve O'Brien Date: Wed, 2 Dec 2015 09:17:38 -0800 Subject: [PATCH] ThreadLocalDetail: fix bug just introduced w/ recent change to constexpr-ctor style class Summary: Small, silly bug which is triggered when there are no keys to unregister, invalidating the current size of the structure. Reviewed By: yzhan Differential Revision: D2712604 fb-gh-sync-id: f6f031936d8e4e458b49c08714f42cb2eec4c4fe --- folly/detail/ThreadLocalDetail.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/folly/detail/ThreadLocalDetail.h b/folly/detail/ThreadLocalDetail.h index 69d2cabd..1c3f2c72 100644 --- a/folly/detail/ThreadLocalDetail.h +++ b/folly/detail/ThreadLocalDetail.h @@ -184,8 +184,8 @@ class PthreadKeyUnregister { ~PthreadKeyUnregister() { std::lock_guard lg(mutex_); - while (size_--) { - pthread_key_delete(keys_[size_]); + while (size_) { + pthread_key_delete(keys_[--size_]); } } -- 2.34.1