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.
#include "PreviewImage.h"
+#include "Buffer.h"
#include "Dimension.h"
#include "GraphicsImage.h"
#include "GraphicsLoader.h"
PreviewImage::Impl::~Impl()
{
- iloader_.filename().removeFile();
+ if (!ploader_.buffer().isClone())
+ iloader_.filename().removeFile();
}