1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 17:47:37 +00:00

fix another pair of #5168 oopses (oopsii?)

This commit is contained in:
Jordan Lee 2012-12-12 21:19:25 +00:00
parent 399c3233b7
commit e2f1d6744e

View file

@ -173,6 +173,8 @@ tr_torrentIsPieceTransferAllowed (tr_torrent * tor,
if (tr_sessionGetActiveSpeedLimit_Bps (tor->session, direction, &limit))
if (limit <= 0)
allowed = false;
tr_torrentUnref (tor);
}
return allowed;
@ -1876,7 +1878,11 @@ tr_torrentUnref (tr_torrent * tor)
{
assert (tr_isTorrent (tor));
if (--tor->refCount == 0)
if (tor->refCount > 1)
{
--tor->refCount;
}
else if (tor->refCount == 1)
{
tr_session * session = tor->session;
@ -1884,6 +1890,8 @@ tr_torrentUnref (tr_torrent * tor)
tr_torrentClearCompletenessCallback (tor);
tr_runInEventThread (session, closeTorrent, tor);
tr_sessionUnlock (session);
--tor->refCount;
}
}