From 750543fc04ce99d9ddadfa1976151e090612cc4c Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Mon, 1 Jun 2015 18:31:01 +0300 Subject: [PATCH] cql3: fix shared_ptr misuse in modification_statement A shared_ptr is mutable, so it must be thread_local, not static. --- cql3/statements/modification_statement.cc | 2 +- cql3/statements/modification_statement.hh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cql3/statements/modification_statement.cc b/cql3/statements/modification_statement.cc index fc42862359..8cb330edde 100644 --- a/cql3/statements/modification_statement.cc +++ b/cql3/statements/modification_statement.cc @@ -36,7 +36,7 @@ namespace cql3 { namespace statements { -::shared_ptr modification_statement::CAS_RESULT_COLUMN = ::make_shared("[applied]", false); +thread_local const ::shared_ptr modification_statement::CAS_RESULT_COLUMN = ::make_shared("[applied]", false); std::ostream& operator<<(std::ostream& out, modification_statement::statement_type t) { diff --git a/cql3/statements/modification_statement.hh b/cql3/statements/modification_statement.hh index 3575b352a3..86d0ede702 100644 --- a/cql3/statements/modification_statement.hh +++ b/cql3/statements/modification_statement.hh @@ -54,7 +54,7 @@ namespace statements { */ class modification_statement : public cql_statement { private: - static ::shared_ptr CAS_RESULT_COLUMN; + static thread_local const ::shared_ptr CAS_RESULT_COLUMN; public: enum class statement_type { INSERT, UPDATE, DELETE };