diff --git a/include/libtorrent/session.hpp b/include/libtorrent/session.hpp index 5070ef3f8..e142b4f3b 100755 --- a/include/libtorrent/session.hpp +++ b/include/libtorrent/session.hpp @@ -82,6 +82,21 @@ namespace libtorrent namespace detail { + // workaround for microsofts + // hardware exceptions that makes + // it hard to debug stuff +#if defined(WIN32) && !defined(NDEBUG) + struct eh_initializer + { + eh_initializer() + { _set_se_translator(straight_to_debugger); } + + static void straight_to_debugger(unsigned int, EXCEPTION_POINTERS*) + { throw; } + }; +#else + struct eh_initializer {}; +#endif // this data is shared between the main thread and the // thread that initialize pieces @@ -178,7 +193,7 @@ namespace libtorrent std::string extract_fingerprint(const peer_id& p); - class session: public boost::noncopyable + class session: public boost::noncopyable, detail::eh_initializer { public: diff --git a/src/session.cpp b/src/session.cpp index 1304316f7..ed163aadf 100755 --- a/src/session.cpp +++ b/src/session.cpp @@ -79,6 +79,7 @@ namespace libtorrent { void checker_impl::operator()() { + eh_initializer(); for (;;) { piece_checker_data* t; @@ -176,6 +177,7 @@ namespace libtorrent void session_impl::operator()() { + eh_initializer(); #if defined(TORRENT_VERBOSE_LOGGING) m_logger = create_log("main session"); #endif