Problem with signals2 and shared_ptr
Hi All,
I am using boost 1.41.0 on Windows with Visual Studio 2008 and am seeing what seems to be an issue with signals2 and shared_ptr. The problem is that the shared_ptr does not decrement is reference count after I disconnect the signals2::connection. This is probably best illustrated with some code.
===== Test.h=====
#ifndef _CLASS1_H
#define _CLASS1_H
#include
Glenn Macgregor wrote:
I am using boost 1.41.0 on Windows with Visual Studio 2008 and am seeing what seems to be an issue with signals2 and shared_ptr. The problem is that the shared_ptr does not decrement is reference count after I disconnect the signals2::connection.
<snip>
The strange thing is the use_count does not decrement after the disconnect or exiting the caller.run function.
Is there a way to force the connection/signal to release that shared_ptr?
This thread may discuss the same issue: http://old.nabble.com/Re%3A--signals2--review--The-review-of-the-signals2-li... Frank has stated that cleaning up the slot earlier is actually a tricky problem, because of the necessity to avoid possible race conditions. Nonetheless I too would be interested in a fix that allows a disconnected connection involving a bound shared_ptr to destroy the shared_ptr instance.
participants (2)
-
Glenn Macgregor
-
Nat Goodspeed