---
 src/frontends/qt4/GuiImage.cpp     | 8 ++++----
 src/frontends/qt4/GuiImage.h       | 2 +-
 src/graphics/GraphicsCacheItem.cpp | 2 +-
 src/graphics/GraphicsImage.h       | 5 +++--
 src/graphics/GraphicsLoader.cpp    | 2 +-
 5 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/frontends/qt4/GuiImage.cpp b/src/frontends/qt4/GuiImage.cpp
index 503ad52..f1643db 100644
--- a/src/frontends/qt4/GuiImage.cpp
+++ b/src/frontends/qt4/GuiImage.cpp
@@ -32,9 +32,9 @@ namespace lyx {
 namespace graphics {
 
 /// Implement factory method defined in GraphicsImage.h
-Image * newImage()
+shared_ptr<Image> newImage()
 {
-       return new GuiImage;
+       return make_shared<GuiImage>();
 }
 
 
@@ -49,9 +49,9 @@ GuiImage::GuiImage(GuiImage const & other)
 {}
 
 
-Image * GuiImage::clone() const
+shared_ptr<Image> GuiImage::clone() const
 {
-       return new GuiImage(*this);
+       return make_shared<GuiImage>(*this);
 }
 
 
diff --git a/src/frontends/qt4/GuiImage.h b/src/frontends/qt4/GuiImage.h
index 6f60644..9e97241 100644
--- a/src/frontends/qt4/GuiImage.h
+++ b/src/frontends/qt4/GuiImage.h
@@ -34,7 +34,7 @@ public:
 
 private:
        /// Create a copy
-       Image * clone() const;
+       shared_ptr<Image> clone() const;
        /// Get the image width
        unsigned int width() const;
        /// Get the image height
diff --git a/src/graphics/GraphicsCacheItem.cpp 
b/src/graphics/GraphicsCacheItem.cpp
index 46b76c5..996b0b5 100644
--- a/src/graphics/GraphicsCacheItem.cpp
+++ b/src/graphics/GraphicsCacheItem.cpp
@@ -292,7 +292,7 @@ bool CacheItem::Impl::loadImage()
 {
        LYXERR(Debug::GRAPHICS, "Loading image.");
 
-       image_.reset(newImage());
+       image_ = newImage();
 
        bool success = image_->load(file_to_load_);
        string const text = success ? "succeeded" : "failed";
diff --git a/src/graphics/GraphicsImage.h b/src/graphics/GraphicsImage.h
index 5488a76..b0d93b4 100644
--- a/src/graphics/GraphicsImage.h
+++ b/src/graphics/GraphicsImage.h
@@ -25,6 +25,7 @@
 #define GRAPHICSIMAGE_H
 
 #include "Dimension.h"
+#include "support/shared_ptr.h"
 
 namespace lyx {
 
@@ -40,7 +41,7 @@ public:
        virtual ~Image() {}
 
        /// Create a copy
-       virtual Image * clone() const = 0;
+       virtual shared_ptr<Image> clone() const = 0;
 
        /// Get the image width
        virtual unsigned int width() const = 0;
@@ -66,7 +67,7 @@ public:
 
 /// Only way to create a new Image.
 /// Implemented in the frontend.
-Image * newImage();
+shared_ptr<Image> newImage();
 
 } // namespace graphics
 } // namespace lyx
diff --git a/src/graphics/GraphicsLoader.cpp b/src/graphics/GraphicsLoader.cpp
index 5260d50..89c1440 100644
--- a/src/graphics/GraphicsLoader.cpp
+++ b/src/graphics/GraphicsLoader.cpp
@@ -429,7 +429,7 @@ void Loader::Impl::createPixmap()
                return;
        }
 
-       image_.reset(cached_item_->image()->clone());
+       image_ = cached_item_->image()->clone();
 
        bool const success = image_->setPixmap(params_);
 
-- 
1.8.0.rc3.16.g8ead1bf


Reply via email to