title: C++ shared_ptr std::bind and std::function
body: <p>I have the following:</p>
  
  <p>class <code>B</code> listens to a <code>boost::signal2</code> of class <code>C</code> and when triggered will execute a callback given by class <code>A</code> and that executes a method in class <code>A</code></p>
  
  <p><code>A</code>, <code>B</code> and <code>C</code>, <code>D</code> are all <code>std::shared_ptr</code>.</p>
  
  <p>The problem is that when class <code>D</code> releases the pointer to class <code>B</code>, <code>B</code> is not being deleted because of the signal handler. Even if I call disconnect on the <code>boost::connection</code> I have the same problem.</p>
  
  <p>Any Idea how I can fix that ?</p>