namespace graphics {
+typedef boost::shared_ptr<Image> ImagePtr;
+
class Loader::Impl : public boost::signals::trackable {
public:
///
*/
Cache::ItemPtr cached_item_;
/// We modify a local copy of the image once it is loaded.
- Image::ImagePtr 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:
///
Loader::~Loader()
-{}
+{
+ delete pimpl_;
+}
Loader & Loader::operator=(Loader const & other)
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);
}
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));
}