From 3218740fd9a5714efce3543f5700073b28c44b39 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Tue, 26 Apr 2016 10:58:30 -0700 Subject: [PATCH] Fix the check for a deleted LV in ListNotifier::add_required_change_info() --- src/impl/list_notifier.cpp | 5 ++++- tests/list.cpp | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/impl/list_notifier.cpp b/src/impl/list_notifier.cpp index 2d14602b..aec9afda 100644 --- a/src/impl/list_notifier.cpp +++ b/src/impl/list_notifier.cpp @@ -71,7 +71,7 @@ void ListNotifier::do_detach_from(SharedGroup& sg) bool ListNotifier::do_add_required_change_info(TransactionChangeInfo& info) { REALM_ASSERT(!m_lv_handover); - if (!m_lv) { + if (!m_lv || !m_lv->is_attached()) { return false; // origin row was deleted after the notification was added } @@ -92,6 +92,9 @@ void ListNotifier::run() m_change.deletions.set(m_prev_size); m_prev_size = 0; } + else { + m_change = {}; + } return; } diff --git a/tests/list.cpp b/tests/list.cpp index 4d079b03..c355a6ed 100644 --- a/tests/list.cpp +++ b/tests/list.cpp @@ -104,6 +104,11 @@ TEST_CASE("list") { auto token = require_change(); write([&] { origin->move_last_over(0); }); REQUIRE_INDICES(change.deletions, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9); + + // Should not resend delete all notification after another commit + change = {}; + write([&] { target->add_empty_row(); }); + REQUIRE(change.empty()); } SECTION("modifying one of the target rows sends a change notification") {