Fix the check for a deleted LV in ListNotifier::add_required_change_info()

This commit is contained in:
Thomas Goyne 2016-04-26 10:58:30 -07:00
parent 632d757014
commit 3218740fd9
2 changed files with 9 additions and 1 deletions

View File

@ -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;
}

View File

@ -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") {