commit 17a033c15a305cc6e2e22acdee891ee44e3b4556
Author: Richard Heck <[email protected]>
Date: Wed Jul 22 11:04:35 2015 -0400
Fix bug noticed by Pavel. Apparently, some changes Abdel made to preview
loading for 2.1.x broke LyXHTML preview of math as images.
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.
diff --git a/src/graphics/PreviewImage.cpp b/src/graphics/PreviewImage.cpp
index 8c3f31d..661c8af 100644
--- a/src/graphics/PreviewImage.cpp
+++ b/src/graphics/PreviewImage.cpp
@@ -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();
}