From f41ff79adbe911667cbc23679d51bdc9302c44d7 Mon Sep 17 00:00:00 2001 From: Richard Shin Date: Sun, 26 Feb 2017 20:30:12 -0800 Subject: [PATCH] Fix CMakeLists and mutation-while-iterating problem --- src/plasma/CMakeLists.txt | 3 +-- src/plasma/plasma_store.cc | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/plasma/CMakeLists.txt b/src/plasma/CMakeLists.txt index b565eb96e1ab2..33cf6db5d188a 100644 --- a/src/plasma/CMakeLists.txt +++ b/src/plasma/CMakeLists.txt @@ -12,8 +12,7 @@ endif(APPLE) include_directories("${PYTHON_INCLUDE_DIRS}" thirdparty) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --std=c99 -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=200809L") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -D_XOPEN_SOURCE=500 --D_POSIX_C_SOURCE=200809L") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=200809L") # Compile flatbuffers diff --git a/src/plasma/plasma_store.cc b/src/plasma/plasma_store.cc index 43cd5e669bbef..9764b696dac6e 100644 --- a/src/plasma/plasma_store.cc +++ b/src/plasma/plasma_store.cc @@ -345,9 +345,9 @@ void update_object_get_requests(PlasmaStoreState *store_state, std::vector &get_requests = store_state->object_get_requests[obj_id]; int index = 0; - // TODO(rshin): return_from_get below will invalidate the iterators in the - // iteration, so the below code is incorrect. - for (GetRequest *get_req : get_requests) { + int num_requests = get_requests.size(); + for (int i = 0; i < num_requests; ++i) { + GetRequest *get_req = get_requests[index]; int num_updated = 0; for (int j = 0; j < get_req->num_objects_to_wait_for; ++j) { object_table_entry *entry;