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.

Sorry again, this one.

Abdel.
Index: GraphicsCacheItem.cpp
===================================================================
--- GraphicsCacheItem.cpp       (revision 19589)
+++ GraphicsCacheItem.cpp       (working copy)
@@ -51,6 +51,9 @@
        ///
        Impl(FileName const & file);
 
+       ~Impl() { statusChanged_connection_.disconnect(); }
+
+
        /** Start the image conversion process, checking first that it is
         *  necessary. If it is necessary, then a conversion task is started.
         *  CacheItem asumes that the conversion is asynchronous and so
@@ -131,6 +134,9 @@
 
        /// The connection of the signal ConvProcess::finishedConversion,
        boost::signals::connection cc_;
+       
+       ///
+       boost::signals::connection statusChanged_connection_;
 
        ///
        boost::scoped_ptr<Converter> converter_;
@@ -191,7 +197,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