fix issue in session_impl::remove_torrent which would cause it to throw

This commit is contained in:
Arvid Norberg 2011-06-21 02:02:58 +00:00
parent 39a68729a5
commit de799e1100
3 changed files with 12 additions and 7 deletions

View File

@ -1578,7 +1578,10 @@ int main(int argc, char* argv[])
std::string event_string;
::print_alert(*i, event_string);
::handle_alert(ses, *i, files, non_files);
TORRENT_TRY
{
::handle_alert(ses, *i, files, non_files);
} TORRENT_CATCH(std::exception& e) {}
events.push_back(event_string);
if (events.size() >= 20) events.pop_front();

View File

@ -685,6 +685,12 @@ namespace libtorrent
void session::remove_torrent(const torrent_handle& h, int options)
{
if (!h.is_valid())
#ifdef BOOST_NO_EXCEPTIONS
return;
#else
throw_invalid_handle();
#endif
TORRENT_ASYNC_CALL2(remove_torrent, h, options);
}

View File

@ -4232,12 +4232,8 @@ namespace aux {
void session_impl::remove_torrent(const torrent_handle& h, int options)
{
boost::shared_ptr<torrent> tptr = h.m_torrent.lock();
if (!tptr)
#ifdef BOOST_NO_EXCEPTIONS
return;
#else
throw_invalid_handle();
#endif
if (!tptr) return;
remove_torrent_impl(tptr, options);
if (m_alerts.should_post<torrent_removed_alert>())