From fbb995f3c5a585d86250cb330d19d2f3f256de7b Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Fri, 9 Jan 2015 14:40:16 +0000 Subject: [PATCH] re PR libstdc++/60966 (std::call_once sometime hangs) PR libstdc++/60966 * include/std/future (packaged_task::operator()): Increment the reference count on the shared state until the function returns. From-SVN: r219393 --- libstdc++-v3/ChangeLog | 6 ++++++ libstdc++-v3/include/std/future | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ce676930cb86..b266521bc95e 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2015-01-09 Jonathan Wakely + + PR libstdc++/60966 + * include/std/future (packaged_task::operator()): Increment the + reference count on the shared state until the function returns. + 2014-12-19 Release Manager * GCC 4.8.4 released. diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future index 507c395eca80..26df9949de56 100644 --- a/libstdc++-v3/include/std/future +++ b/libstdc++-v3/include/std/future @@ -1417,7 +1417,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION operator()(_ArgTypes... __args) { __future_base::_State_base::_S_check(_M_state); - _M_state->_M_run(std::forward<_ArgTypes>(__args)...); + auto __state = _M_state; + __state->_M_run(std::forward<_ArgTypes>(__args)...); } void -- 2.47.2