Abdelrazak Younes wrote:
Bo Peng wrote:
The best solution actually is to store
the signal connection inside CacheItem actually. So neither your patch
nor mine is correct.

I have told you that the attached patch does not work (and ~Impl() is
not called). Am I missing something?

Ah? Sorry, I missed that one. Try this one then.

Try also this one. I suspect that the scoped_ptr delays the effective destruction of the pimpl_.

Abdel.

Index: GraphicsCacheItem.cpp
===================================================================
--- GraphicsCacheItem.cpp       (revision 19589)
+++ GraphicsCacheItem.cpp       (working copy)
@@ -131,6 +131,9 @@
 
        /// The connection of the signal ConvProcess::finishedConversion,
        boost::signals::connection cc_;
+       
+       ///
+       boost::signals::connection statusChanged_connection_;
 
        ///
        boost::scoped_ptr<Converter> converter_;
@@ -143,7 +146,9 @@
 
 
 CacheItem::~CacheItem()
-{}
+{
+       pimpl_->statusChanged_connection_.disconnect();
+}
 
 
 FileName const & CacheItem::filename() const
@@ -191,7 +196,9 @@
 
 boost::signals::connection CacheItem::connect(slot_type const & slot) const
 {
-       return pimpl_->statusChanged.connect(slot);
+       pimpl_->statusChanged_connection_.disconnect();
+       pimpl_->statusChanged_connection_ = pimpl_->statusChanged.connect(slot);
+       return pimpl_->statusChanged_connection_;
 }
 
 

Reply via email to