mirror of
https://github.com/transmission/transmission
synced 2025-01-31 03:12:44 +00:00
fix race condition triggered in the unit tests by requiring a libtransmission thread lock in torrentRemove()
This commit is contained in:
parent
0b9f651a93
commit
4aa4012a73
2 changed files with 14 additions and 11 deletions
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue