diff --git a/libtransmission/fdlimit.c b/libtransmission/fdlimit.c index 9a51c1d0c..546e988a2 100644 --- a/libtransmission/fdlimit.c +++ b/libtransmission/fdlimit.c @@ -607,7 +607,9 @@ tr_fdFileGetCachedMTime (tr_session * s, int torrent_id, tr_file_index_t i, time void tr_fdTorrentClose (tr_session * session, int torrent_id) { - fileset_close_torrent (get_fileset (session), torrent_id); + assert (tr_sessionIsLocked (session)); + + fileset_close_torrent (get_fileset (session), torrent_id); } /* returns an fd on success, or a -1 on failure and sets errno */ diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index a27cb0f44..d48c6e222 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -1734,10 +1734,7 @@ void tr_torrentVerify (tr_torrent * tor) { if (tr_isTorrent (tor)) - { - tr_verifyRemove (tor); - tr_runInEventThread (tor->session, verifyTorrent, tor); - } + tr_runInEventThread (tor->session, verifyTorrent, tor); } void @@ -1848,14 +1845,18 @@ static void tr_torrentDeleteLocalData (tr_torrent *, tr_fileFunc); static void removeTorrent (void * vdata) { - struct remove_data * data = vdata; + struct remove_data * data = vdata; + tr_session * session = data->tor->session; + tr_sessionLock (session); - if (data->deleteFlag) - tr_torrentDeleteLocalData (data->tor, data->deleteFunc); + if (data->deleteFlag) + tr_torrentDeleteLocalData (data->tor, data->deleteFunc); - tr_torrentClearCompletenessCallback (data->tor); - closeTorrent (data->tor); - tr_free (data); + tr_torrentClearCompletenessCallback (data->tor); + closeTorrent (data->tor); + tr_free (data); + + tr_sessionUnlock (session); } void