Boost logo

Boost :

Subject: [boost] [asio] Bug in allocation of timer
From: puzirev_at_[hidden]
Date: 2009-05-28 16:50:15

Wrong allocation of timer in timer_queue.hpp:

template <typename Handler>
bool enqueue_timer(const time_type& time, Handler handler, void* token)
   // Create a new timer object.
   std::auto_ptr<timer<Handler> > new_timer(
       new timer<Handler>(time, handler, token)); // <-- ATTENTION
new timer<Handler>(...) later will be dealocated with
Solution: allocate new timers with asio_handler_allocate

   // Create a new timer object.
   typedef timer<Handler> timer_type;
   typedef handler_alloc_traits<Handler, timer_type> alloc_traits;
   raw_handler_ptr<alloc_traits> raw_ptr(handler);
   handler_ptr<alloc_traits> new_timer(raw_ptr, time, handler, token);

Boost list run by bdawes at, gregod at, cpdaniel at, john at