From 66666a75b0415f457b35dee8d589d8ee43b0181a Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Tue, 19 Apr 2016 15:16:15 -0700 Subject: [PATCH] Iterate backwards to pick the last valid list in select_link_list --- src/impl/transact_log_handler.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/impl/transact_log_handler.cpp b/src/impl/transact_log_handler.cpp index 8aedd052..86db5544 100644 --- a/src/impl/transact_log_handler.cpp +++ b/src/impl/transact_log_handler.cpp @@ -464,11 +464,13 @@ public: mark_dirty(row, col); m_active = nullptr; - for (auto& o : m_info.lists) { - if (o.table_ndx == current_table() && o.row_ndx == row && o.col_ndx == col) { - m_active = o.changes; - // need to use last match for multiple source version logic -// break; + // When there are multiple source versions there could be multiple + // change objects for a single LinkView, in which case we need to use + // the last one + for (auto it = m_info.lists.rbegin(), end = m_info.lists.rend(); it != end; ++it) { + if (it->table_ndx == current_table() && it->row_ndx == row && it->col_ndx == col) { + m_active = it->changes; + break; } } return true;