Ticket #1510: rtorrent.finished[1].patch

File rtorrent.finished[1].patch, 1.2 KB (added by dbrobins (AT) i4031.net, 3 years ago)
  • src/core/download_list.cc

    old new  
    563563  // up/downloaded baseline. 
    564564  download->download()->tracker_list()->send_completed(); 
    565565 
     566        // save the hash in case the event deletes the object (e.g. d.erase) 
     567        torrent::HashString infohash = download->download()->info_hash(); 
     568 
    566569  rpc::commands.call_catch("event.download.finished", rpc::make_target(download), torrent::Object(), "Download event action failed: "); 
    567570 
    568571  if (download->resume_flags() != ~uint32_t()) 
    569572    throw torrent::internal_error("DownloadList::confirm_finished(...) download->resume_flags() != ~uint32_t()."); 
    570573 
    571         if (!download->is_active() && rpc::call_command_value("d.get_state", rpc::make_target(download)) == 1) 
    572                 resume(download, torrent::Download::start_no_create | torrent::Download::start_skip_tracker | torrent::Download::start_keep_baseline); 
     574  if (find(infohash) != end()) { 
     575                if (!download->is_active() && rpc::call_command_value("d.get_state", rpc::make_target(download)) == 1) 
     576                        resume(download, torrent::Download::start_no_create | torrent::Download::start_skip_tracker | torrent::Download::start_keep_baseline); 
     577        } 
    573578} 
    574579 
    575580}