]> git.lyx.org Git - lyx.git/commitdiff
Fix bug noticed by Pavel. Apparently, some changes Abdel made to preview loading...
authorRichard Heck <rgheck@lyx.org>
Wed, 22 Jul 2015 15:04:35 +0000 (11:04 -0400)
committerRichard Heck <rgheck@lyx.org>
Wed, 22 Jul 2015 15:04:35 +0000 (11:04 -0400)
We have been here before. The png files are generated, but then by the time we preview the document, they are gone. This is because (a) when the PreviewLoader for a Buffer is deleted, it removes all its previews and (b) we export in a clone, so that Buffer gets deleted before the preview is actually shown. So we need to check whether we are a preview for a clone before we delete anything.

src/graphics/PreviewImage.cpp

index 8c3f31d44f9ea15b7846c1094f896417056888bf..661c8af8d19f947ac5216a4f2e2a2c252f8999bc 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "PreviewImage.h"
 
+#include "Buffer.h"
 #include "Dimension.h"
 #include "GraphicsImage.h"
 #include "GraphicsLoader.h"
@@ -112,7 +113,8 @@ PreviewImage::Impl::Impl(PreviewImage & p, PreviewLoader & l,
 
 PreviewImage::Impl::~Impl()
 {
-       iloader_.filename().removeFile();
+       if (!ploader_.buffer().isClone())
+               iloader_.filename().removeFile();
 }