The graphics code insists on an absolute path to the file. This patch 
supplies it with such a path to a previewed snippet when the tmp directory 
is not used and therefore fixes a crash.

Ok to apply to 1.3.x Jean-Marc?

-- 
Angus
Index: src/graphics/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/graphics/ChangeLog,v
retrieving revision 1.147
diff -u -p -r1.147 ChangeLog
--- src/graphics/ChangeLog	26 Feb 2003 13:10:16 -0000	1.147
+++ src/graphics/ChangeLog	26 Feb 2003 15:39:03 -0000
@@ -1,3 +1,8 @@
+2003-02-26  Angus Leeming  <[EMAIL PROTECTED]>
+
+	* PreviewLoader.C (startLoading): Prevent a crash if the user is
+	not using a tmp directory.
+
 2003-02-26  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* PreviewedInset.[Ch]: strip out the caching of the BufferView and
Index: src/graphics/PreviewLoader.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/graphics/PreviewLoader.C,v
retrieving revision 1.41
diff -u -p -r1.41 PreviewLoader.C
--- src/graphics/PreviewLoader.C	25 Feb 2003 12:32:27 -0000	1.41
+++ src/graphics/PreviewLoader.C	26 Feb 2003 15:39:04 -0000
@@ -449,7 +449,11 @@ void PreviewLoader::Impl::startLoading()
 	lyxerr[Debug::GRAPHICS] << "PreviewLoader::startLoading()" << endl;
 
 	// As used by the LaTeX file and by the resulting image files
-	string const filename_base(unique_filename(buffer_.tmppath));
+	string directory = buffer_.tmppath;
+	if (directory.empty())
+		directory = buffer_.filePath();
+	
+	string const filename_base(unique_filename(directory));
 
 	// Create an InProgress instance to place in the map of all
 	// such processes if it starts correctly.

Reply via email to