mirror of
https://github.com/transmission/transmission
synced 2024-12-21 23:32:35 +00:00
fix: obtain session lock before getting tor ptr (#7286)
This commit is contained in:
parent
8bca3f2e06
commit
b2ce9eea83
1 changed files with 6 additions and 11 deletions
|
@ -1603,21 +1603,16 @@ void tr_torrentVerify(tr_torrent* tor)
|
|||
tor->session->run_in_session_thread(
|
||||
[session = tor->session, tor_id = tor->id()]()
|
||||
{
|
||||
TR_ASSERT(session->am_in_session_thread());
|
||||
auto const lock = session->unique_lock();
|
||||
|
||||
auto* const tor = session->torrents().get(tor_id);
|
||||
if (tor == nullptr)
|
||||
if (tor == nullptr || tor->is_deleting_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TR_ASSERT(tor->session->am_in_session_thread());
|
||||
auto const lock = tor->unique_lock();
|
||||
|
||||
if (tor->is_deleting_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
tor->session->verify_remove(tor);
|
||||
session->verify_remove(tor);
|
||||
|
||||
if (!tor->has_metainfo())
|
||||
{
|
||||
|
@ -1637,7 +1632,7 @@ void tr_torrentVerify(tr_torrent* tor)
|
|||
tor->start_when_stable_ = false;
|
||||
}
|
||||
|
||||
tor->session->verify_add(tor);
|
||||
session->verify_add(tor);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue