From ef9d4eee3321152b7b2642623c0e216e16728167 Mon Sep 17 00:00:00 2001 From: Jordan Lee Date: Fri, 1 Feb 2013 00:21:30 +0000 Subject: [PATCH] (libT) ensure that tr_torrentVerify()'s completion callback gets invoked even if it's removed from the verify queue before it gets a chance to run. --- libtransmission/verify.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libtransmission/verify.c b/libtransmission/verify.c index b79e223f2..c27cba158 100644 --- a/libtransmission/verify.c +++ b/libtransmission/verify.c @@ -309,8 +309,17 @@ tr_verifyRemove (tr_torrent * tor) } else { - tr_free (tr_list_remove (&verifyList, tor, compareVerifyByTorrent)); + struct verify_node * node = tr_list_remove (&verifyList, tor, compareVerifyByTorrent); + tr_torrentSetVerifyState (tor, TR_VERIFY_NONE); + + if (node != NULL) + { + if (node->callback_func != NULL) + (*node->callback_func)(tor, true, node->callback_data); + + tr_free (node); + } } tr_lockUnlock (lock); -- 2.40.0