diff --git a/libtransmission/torrent.cc b/libtransmission/torrent.cc index 0b0dc2203..0b84835ec 100644 --- a/libtransmission/torrent.cc +++ b/libtransmission/torrent.cc @@ -1865,7 +1865,8 @@ void tr_torrent::set_labels(labels_t const& new_labels) } } labels_.shrink_to_fit(); - this->set_dirty(); + set_dirty(); + mark_edited(); } // --- @@ -1960,6 +1961,7 @@ void tr_torrent::set_file_priorities(tr_file_index_t const* files, tr_file_index file_priorities_.set(files, file_count, priority); priority_changed_.emit(this, files, file_count, priority); set_dirty(); + mark_changed(); } } @@ -2254,7 +2256,6 @@ size_t tr_torrentFindFileToBuf(tr_torrent const* tor, tr_file_index_t file_num, void tr_torrent::set_download_dir(std::string_view path, bool is_new_torrent) { download_dir_ = path; - mark_changed(); mark_edited(); set_dirty(); refresh_current_dir(); @@ -2535,7 +2536,9 @@ bool tr_torrentHasMetadata(tr_torrent const* tor) void tr_torrent::mark_edited() { - this->date_edited_ = tr_time(); + auto const now = tr_time(); + bump_date_edited(now); + bump_date_changed(now); } void tr_torrent::mark_changed() diff --git a/libtransmission/torrent.h b/libtransmission/torrent.h index 108dfd71f..09e4ef1f2 100644 --- a/libtransmission/torrent.h +++ b/libtransmission/torrent.h @@ -440,6 +440,7 @@ struct tr_torrent file_priorities_.set(file, priority); priority_changed_.emit(this, &file, 1U, priority); set_dirty(); + mark_changed(); } } @@ -1255,11 +1256,6 @@ private: } } - constexpr void bump_date_changed(time_t when) - { - date_changed_ = std::max(date_changed_, when); - } - void set_verify_state(VerifyState state); [[nodiscard]] constexpr std::optional verify_progress() const noexcept @@ -1289,7 +1285,18 @@ private: completion_.set_has_piece(piece, has); } + constexpr void bump_date_changed(time_t when) + { + date_changed_ = std::max(date_changed_, when); + } + void mark_changed(); + + constexpr void bump_date_edited(time_t when) + { + date_edited_ = std::max(date_edited_, when); + } + void mark_edited(); constexpr void set_dirty(bool dirty = true) noexcept