]> git.lyx.org Git - lyx.git/blobdiff - src/graphics/PreviewImage.cpp
Fix bug in replacement of "$$s/" in converter commands, introduced in 8b66f9ce.
[lyx.git] / src / graphics / PreviewImage.cpp
index 5eecfcc48a8f1a7add5a059b1726c9414e48ae10..80e8e2013513575cc8dfc500a7d9f554d70c10b7 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "PreviewImage.h"
 
+#include "Buffer.h"
 #include "Dimension.h"
 #include "GraphicsImage.h"
 #include "GraphicsLoader.h"
@@ -27,7 +28,7 @@ using namespace lyx::support;
 namespace lyx {
 namespace graphics {
 
-class PreviewImage::Impl : public boost::signals::trackable {
+class PreviewImage::Impl : public boost::signals2::trackable {
 public:
        ///
        Impl(PreviewImage & p, PreviewLoader & l,
@@ -85,7 +86,7 @@ Dimension PreviewImage::dim() const
        if (!image)
                return dim;
 
-       dim.asc = int(pimpl_->ascent_frac_ * double(image->height()));
+       dim.asc = int(pimpl_->ascent_frac_ * double(image->height()) + 0.5);
        dim.des = image->height() - dim.asc;
        dim.wid = image->width();
        return dim;
@@ -112,7 +113,11 @@ PreviewImage::Impl::Impl(PreviewImage & p, PreviewLoader & l,
 
 PreviewImage::Impl::~Impl()
 {
-       iloader_.filename().removeFile();
+       // If these images are generated for a clone, then that may be
+       // because we are previewing. We therefore do not want to delete
+       // them when this Buffer is destroyed.
+       if (!ploader_.buffer().isClone())
+               iloader_.filename().removeFile();
 }