Dear all, Using a gcc3 compiled lyx, when we remove the underlying figure of a graphic inset that is copied and pasted, lyx crashes.
This is because 'cached_item_.connect()' is not properly disconnected when the cached_item_ is reset. This may not be related to the signals/desctructor problem we have discussed. + // cached_item_ is going to be reset, so the connected + // signal needs to be disconnected. + sc_.disconnect(); cached_item_.reset(); The patch is simple and should have no unexpected side effect. If there is no objection, I will apply it to the branch. I will also revert Abdel's patch when I apply it to the trunk. After all, we should not fix a bug that does not exist (yet). Cheers, Bo
Index: src/graphics/GraphicsLoader.cpp =================================================================== --- src/graphics/GraphicsLoader.cpp (revision 19591) +++ src/graphics/GraphicsLoader.cpp (working copy) @@ -56,6 +56,8 @@ Image::ImagePtr image_; /// This signal is emitted when the image loading status changes. boost::signal<void()> signal_; + /// The connection of the signal StatusChanged + boost::signals::connection sc_; private: /// @@ -222,6 +224,9 @@ if (!old_file.empty()) { continue_monitoring = cached_item_->monitoring(); + // cached_item_ is going to be reset, so the connected + // signal needs to be disconnected. + sc_.disconnect(); cached_item_.reset(); Cache::get().remove(old_file); } @@ -243,7 +248,7 @@ if (continue_monitoring && !cached_item_->monitoring()) cached_item_->startMonitoring(); - cached_item_->connect(boost::bind(&Impl::statusChanged, this)); + sc_ = cached_item_->connect(boost::bind(&Impl::statusChanged, this)); } Index: status.15x =================================================================== --- status.15x (revision 19591) +++ status.15x (working copy) @@ -67,6 +67,8 @@ - Fix crash when using the LFUN 'buffer-write-as' with an argument that is not an absolute path (Bug 4135). +- Fix crash when a user removes the underlying figure of a graphic inset + that has been copied and pasted (Bug 4108). * DOCUMENTATION