From: Steve O'Brien Date: Wed, 2 Dec 2015 17:17:38 +0000 (-0800) Subject: ThreadLocalDetail: fix bug just introduced w/ recent change to constexpr-ctor style... X-Git-Tag: deprecate-dynamic-initializer~212 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=398f83735ae9c087774af4894a794510a1e375c0;p=folly.git 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 --- 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_]); } }