mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: introduce register_dive() function
There was a weird asymmetry, where the undo-commands would register the fulltext index of the dive, but the core would unregister the fulltext index in the "unregister_dive()" function. To make this more logical, create a "register_dive()" function in core that does registers the fulltext index. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
aa60e5d21d
commit
b9df26066e
3 changed files with 21 additions and 12 deletions
|
@ -72,18 +72,7 @@ dive *DiveListBase::addDive(DiveToAdd &d)
|
|||
d.site->add_dive(d.dive.get());
|
||||
diveSiteCountChanged(d.site);
|
||||
}
|
||||
dive *res = d.dive.release(); // Give up ownership of dive
|
||||
|
||||
// When we add dives, we start in hidden-by-filter status. Once all
|
||||
// dives have been added, their status will be updated.
|
||||
res->hidden_by_filter = true;
|
||||
|
||||
int idx = dive_table_get_insertion_index(divelog.dives.get(), res);
|
||||
fulltext_register(res); // Register the dive's fulltext cache
|
||||
add_to_dive_table(divelog.dives.get(), idx, res); // Return ownership to backend
|
||||
invalidate_dive_cache(res); // Ensure that dive is written in git_save()
|
||||
|
||||
return res;
|
||||
return register_dive(std::move(d.dive)); // Transfer ownership to core and update fulltext index
|
||||
}
|
||||
|
||||
// Some signals are sent in batches per trip. To avoid writing the same loop
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue