Angus Leeming wrote:
> Ok, the crash occurs because runparams.exportdata == 0, so the
> dereferencing that occurs here is bogus.
>
> int InsetExternal::latex(Buffer const & buf, ostream & os,
> OutputParams const & runparams) const
> {
> return external::writeExternal(params_, "LaTeX", buf, os,
> *(runparams.exportdata),
> external_in_tmpdir);
>
> So, your 'hack' is broken.
Attached is a 'reasonable' patch, which I'll commit.
--
Angus
Index: src/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/Makefile.am,v
retrieving revision 1.210
diff -u -p -r1.210 Makefile.am
--- src/Makefile.am 28 May 2004 07:14:57 -0000 1.210
+++ src/Makefile.am 3 Jun 2004 12:56:41 -0000
@@ -225,6 +225,7 @@ lyx_SOURCES = \
metricsinfo.h \
output.C \
output.h \
+ outputparams.C \
outputparams.h \
output_docbook.C \
output_docbook.h \
Index: src/exporter.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/exporter.C,v
retrieving revision 1.52
diff -u -p -r1.52 exporter.C
--- src/exporter.C 1 Jun 2004 13:39:33 -0000 1.52
+++ src/exporter.C 3 Jun 2004 12:56:41 -0000
@@ -136,8 +136,6 @@ bool Exporter::Export(Buffer * buffer, s
OutputParams runparams;
runparams.flavor = OutputParams::LATEX;
runparams.linelen = lyxrc.ascii_linelen;
- ExportData exportdata;
- runparams.exportdata = &exportdata;
vector<string> backends = Backends(*buffer);
if (find(backends.begin(), backends.end(), format) == backends.end()) {
for (vector<string>::const_iterator it = backends.begin();
@@ -200,7 +198,8 @@ bool Exporter::Export(Buffer * buffer, s
formats.extension(format));
// We need to copy referenced files (e. g. included graphics
// if format == "dvi") to the result dir.
- vector<ExportedFile> const files = exportdata.externalFiles(format);
+ vector<ExportedFile> const files =
+ runparams.exportdata->externalFiles(format);
string const dest = OnlyPath(result_file);
CopyStatus status = SUCCESS;
for (vector<ExportedFile>::const_iterator it = files.begin();
Index: src/outputparams.C
===================================================================
RCS file: src/outputparams.C
diff -N src/outputparams.C
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/outputparams.C 3 Jun 2004 12:56:41 -0000
@@ -0,0 +1,26 @@
+/**
+ * \file outputparams.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Angus Leeming
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "outputparams.h"
+#include "exporter.h"
+
+
+OutputParams::OutputParams()
+ : flavor(LATEX), nice(false), moving_arg(false),
+ free_spacing(false), use_babel(false),
+ mixed_content(false), linelen(0),
+ exportdata(new ExportData)
+{}
+
+
+OutputParams::~OutputParams()
+{}
Index: src/outputparams.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/outputparams.h,v
retrieving revision 1.5
diff -u -p -r1.5 outputparams.h
--- src/outputparams.h 1 Jun 2004 13:39:33 -0000 1.5
+++ src/outputparams.h 3 Jun 2004 12:56:41 -0000
@@ -13,6 +13,7 @@
#define OUTPUTPARAMS_H
#include "support/types.h"
+#include <boost/shared_ptr.hpp>
class ExportData;
@@ -26,11 +27,8 @@ struct OutputParams {
XML
};
- OutputParams()
- : flavor(LATEX), nice(false), moving_arg(false),
- free_spacing(false), use_babel(false),
- mixed_content(false), linelen(0), exportdata(0)
- {}
+ OutputParams();
+ ~OutputParams();
/** The latex that we export depends occasionally on what is to
compile the file.
@@ -60,7 +58,7 @@ struct OutputParams {
bool use_babel;
/** Used for docbook to see if inside a region of mixed content.
- In that case all the white spaces are significant and can not appear
+ In that case all the white spaces are significant and cannot appear
at the begin or end.
*/
bool mixed_content;
@@ -73,7 +71,7 @@ struct OutputParams {
This is a hack: Make it possible to add stuff to constant
OutputParams instances.
*/
- ExportData *exportdata;
+ boost::shared_ptr<ExportData> exportdata;
};
-#endif // LATEXRUNPARAMS_H
+#endif // NOT OUTPUTPARAMS_H