Changeset 13905


Ignore:
Timestamp:
Jan 31, 2013, 5:05:44 AM (8 years ago)
Author:
jordan
Message:

fix race condition triggered in the unit tests by requiring a libtransmission thread lock in torrentRemove()

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/fdlimit.c

    r13868 r13905  
    608608tr_fdTorrentClose (tr_session * session, int torrent_id)
    609609{
    610     fileset_close_torrent (get_fileset (session), torrent_id);
     610  assert (tr_sessionIsLocked (session));
     611
     612  fileset_close_torrent (get_fileset (session), torrent_id);
    611613}
    612614
  • trunk/libtransmission/torrent.c

    r13881 r13905  
    17351735{
    17361736  if (tr_isTorrent (tor))
    1737     {
    1738       tr_verifyRemove (tor);
    1739       tr_runInEventThread (tor->session, verifyTorrent, tor);
    1740     }
     1737    tr_runInEventThread (tor->session, verifyTorrent, tor);
    17411738}
    17421739
     
    18491846removeTorrent (void * vdata)
    18501847{
    1851     struct remove_data * data = vdata;
    1852 
    1853     if (data->deleteFlag)
    1854         tr_torrentDeleteLocalData (data->tor, data->deleteFunc);
    1855 
    1856     tr_torrentClearCompletenessCallback (data->tor);
    1857     closeTorrent (data->tor);
    1858     tr_free (data);
     1848  struct remove_data * data = vdata;
     1849  tr_session * session = data->tor->session;
     1850  tr_sessionLock (session);
     1851
     1852  if (data->deleteFlag)
     1853    tr_torrentDeleteLocalData (data->tor, data->deleteFunc);
     1854
     1855  tr_torrentClearCompletenessCallback (data->tor);
     1856  closeTorrent (data->tor);
     1857  tr_free (data);
     1858
     1859  tr_sessionUnlock (session);
    18591860}
    18601861
Note: See TracChangeset for help on using the changeset viewer.