1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-11 22:52:53 +00:00

Avoid doing some potentially bogus things when stopping and deleting a torrent.

This commit is contained in:
Josh Elsasser 2006-12-11 23:12:09 +00:00
parent a5c14049ef
commit e0790f955a
2 changed files with 9 additions and 4 deletions

View file

@ -275,14 +275,17 @@ tr_backend_stop_torrents(TrBackend *back) {
gboolean gboolean
tr_backend_torrents_stopped(TrBackend *back) { tr_backend_torrents_stopped(TrBackend *back) {
GList *ii, *list; GList *ii, *list;
tr_stat_t *st;
gboolean ret = TRUE; gboolean ret = TRUE;
TR_IS_BACKEND(back); TR_IS_BACKEND(back);
list = g_list_copy(back->torrents); list = g_list_copy(back->torrents);
for(ii = list; NULL != ii; ii = ii->next) for(ii = list; NULL != ii; ii = ii->next) {
if(!(TR_STATUS_PAUSE & tr_torrent_stat_polite(ii->data)->status)) st = tr_torrent_stat_polite(ii->data);
if(NULL == st || !(TR_STATUS_PAUSE & st->status))
ret = FALSE; ret = FALSE;
}
g_list_free(list); g_list_free(list);
return ret; return ret;

View file

@ -450,15 +450,17 @@ tr_torrent_stop_politely(TrTorrent *tor) {
tr_stat_t * tr_stat_t *
tr_torrent_stat_polite(TrTorrent *tor) { tr_torrent_stat_polite(TrTorrent *tor) {
TrTorrentClass *klass; TrTorrentClass *klass;
tr_stat_t *st = tr_torrentStat(tor->handle); tr_stat_t *st;
if(tor->disposed) if(tor->disposed)
return st; return NULL;
st = tr_torrentStat(tor->handle);
if(tor->closing && TR_STATUS_PAUSE & st->status) { if(tor->closing && TR_STATUS_PAUSE & st->status) {
tor->closing = FALSE; tor->closing = FALSE;
klass = g_type_class_peek(TR_TORRENT_TYPE); klass = g_type_class_peek(TR_TORRENT_TYPE);
g_signal_emit(tor, klass->paused_signal_id, 0, NULL); g_signal_emit(tor, klass->paused_signal_id, 0, NULL);
return tr_torrent_stat_polite(tor);
} }
return st; return st;