From 0e1d2ede70820ff9a7039323f6a3555fde8cb7ea Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Mon, 30 Jun 2008 07:58:50 +0000 Subject: [PATCH] fix invariant-check bug in peer_connection --- src/peer_connection.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index a1c756f30..da82bbf15 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -2510,11 +2510,13 @@ namespace libtorrent void peer_connection::second_tick(float tick_interval) { - INVARIANT_CHECK; - ptime now(time_now()); boost::intrusive_ptr me(self()); + // the invariant check must be run before me is destructed + // in case the peer got disconnected + INVARIANT_CHECK; + boost::shared_ptr t = m_torrent.lock(); if (!t || m_disconnecting) {