fix issue in session_impl::remove_torrent which would cause it to throw
This commit is contained in:
parent
39a68729a5
commit
de799e1100
|
@ -1578,7 +1578,10 @@ int main(int argc, char* argv[])
|
||||||
std::string event_string;
|
std::string event_string;
|
||||||
|
|
||||||
::print_alert(*i, 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);
|
events.push_back(event_string);
|
||||||
if (events.size() >= 20) events.pop_front();
|
if (events.size() >= 20) events.pop_front();
|
||||||
|
|
|
@ -685,6 +685,12 @@ namespace libtorrent
|
||||||
|
|
||||||
void session::remove_torrent(const torrent_handle& h, int options)
|
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);
|
TORRENT_ASYNC_CALL2(remove_torrent, h, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4232,12 +4232,8 @@ namespace aux {
|
||||||
void session_impl::remove_torrent(const torrent_handle& h, int options)
|
void session_impl::remove_torrent(const torrent_handle& h, int options)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<torrent> tptr = h.m_torrent.lock();
|
boost::shared_ptr<torrent> tptr = h.m_torrent.lock();
|
||||||
if (!tptr)
|
if (!tptr) return;
|
||||||
#ifdef BOOST_NO_EXCEPTIONS
|
|
||||||
return;
|
|
||||||
#else
|
|
||||||
throw_invalid_handle();
|
|
||||||
#endif
|
|
||||||
remove_torrent_impl(tptr, options);
|
remove_torrent_impl(tptr, options);
|
||||||
|
|
||||||
if (m_alerts.should_post<torrent_removed_alert>())
|
if (m_alerts.should_post<torrent_removed_alert>())
|
||||||
|
|
Loading…
Reference in New Issue