[LyX/master] Revert part of 47973dc2b, which was causing bug #11873.

Richard Kimberly Heck rikiheck at lyx.org
Sat May 23 03:19:04 UTC 2020


commit 44dc38e120e04b7a6b1d275ff8e2f69993739b31
Author: Richard Kimberly Heck <rikiheck at lyx.org>
Date:   Fri May 22 23:43:44 2020 -0400

    Revert part of 47973dc2b, which was causing bug #11873.
---
 src/graphics/PreviewLoader.cpp |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp
index f15752c..e3daaa7 100644
--- a/src/graphics/PreviewLoader.cpp
+++ b/src/graphics/PreviewLoader.cpp
@@ -319,18 +319,26 @@ Buffer const & PreviewLoader::buffer() const
 
 namespace {
 
-std::function<SnippetPair (string const &)> IncrementedFileName
-	(string const & to_format, string const & filename_base)
-{
-	return [&to_format, &filename_base](string const & snippet)
+class IncrementedFileName {
+public:
+	IncrementedFileName(string const & to_format,
+			    string const & filename_base)
+		: to_format_(to_format), base_(filename_base), counter_(1)
+	{}
+
+	SnippetPair const operator()(string const & snippet)
 	{
-		static int counter_ = 1;
 		ostringstream os;
-		os << filename_base << counter_++ << '.' << to_format;
-		string const file = os.str();
-		return make_pair(snippet, FileName(file));
-	};
-}
+		os << base_ << counter_++ << '.' << to_format_;
+		string const file_name = os.str();
+		return make_pair(snippet, FileName(file_name));
+	}
+	
+private:
+	string const & to_format_;
+	string const & base_;
+	int counter_;
+};
 
 
 InProgress::InProgress(string const & filename_base,


More information about the lyx-cvs mailing list