From d77fc1668c0300637e129216834d1b30ccdd228b Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Tue, 15 Feb 2011 17:11:03 +0000 Subject: [PATCH] Fix bug #7263: Instant Preview crash. I guess this deserves to be sorted out better, because we are doing tricky things by deleted the object from itself. Problem: PreviewImage? has a member PreviewLoader?. PreviewImage::Impl::statusChanged() calls PreviewLoader::remove. PreviewLoader::Impl::remove removes a snippet from the cache. In the cache is a map of the snippet and a shared pointer to PreviewImage?. This means that removing the snippet from the cache, destroys the PreviewImage?. When we get back to PreviewImage::Impl::statusChanged() this will start to crash. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37681 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/graphics/PreviewImage.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/graphics/PreviewImage.cpp b/src/graphics/PreviewImage.cpp index 7fe9f2a769..58e25fbd06 100644 --- a/src/graphics/PreviewImage.cpp +++ b/src/graphics/PreviewImage.cpp @@ -139,7 +139,10 @@ void PreviewImage::Impl::statusChanged() case ErrorUnknown: //iloader_.filename().removeFile(); ploader_.remove(snippet_); - break; + // FIXME: We need to return here, because PreviewLoader::remove + // removes the preview image from the cache, which deletes this + // object, so we should not try to do anything here. + return; case Ready: iloader_.filename().removeFile(); -- 2.39.2