+2004-06-02 Angus Leeming <leeming@lyx.org>
+
+ Fix crash caused by dereferencing null pointer 'exportdata' in
+ OutputParams by creating a new ExportData variable on the heap,
+ storing it in a boost::shared_ptr.
+ The crash was triggered when generating an Instant Preview
+ of an external inset.
+
+ * Makefile.am: add outputparams.C
+
+ * outputparams.[Ch]: store exportdata as a shared_ptr<Exportdata>.
+ (c-tor): allocate memory to it.
+
+ * exporter.C (c-tor): associated changes.
+
2004-06-01 Angus Leeming <leeming@lyx.org>
* output_linuxdoc.C (linuxdocParagraphs): Check that the paragraph
metricsinfo.h \
output.C \
output.h \
+ outputparams.C \
outputparams.h \
output_docbook.C \
output_docbook.h \
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();
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();
--- /dev/null
+/**
+ * \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()
+{}
#define OUTPUTPARAMS_H
#include "support/types.h"
+#include <boost/shared_ptr.hpp>
class ExportData;
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.
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;
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