From 7dfc05c098cc62a4e3144d2bb54cf985c14c2c68 Mon Sep 17 00:00:00 2001 From: orignal Date: Sun, 18 Oct 2026 09:38:10 -0400 Subject: [PATCH] don't save piece of removed torrent --- libi2pd_client/Torrents.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libi2pd_client/Torrents.cpp b/libi2pd_client/Torrents.cpp index 29d9c54c..2dcfaaef 100644 --- a/libi2pd_client/Torrents.cpp +++ b/libi2pd_client/Torrents.cpp @@ -1824,8 +1824,10 @@ namespace torrents if (piece.VerifyHash ()) { boost::asio::post (GetTorrentsTunnel ()->GetDiskIOService (), - [index, torrent = m_Torrent]() mutable + [index, t = std::weak_ptr (m_Torrent)]() mutable { + auto torrent = t.lock (); + if (!torrent) return; // torrent doesn't exist anymore auto fragments = torrent->GetPieceFileFragments (index); Piece& piece = torrent->GetPiece (index); for (auto& it: fragments)