mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-26 22:17:41 +00:00
Fix crash when generating instant preview of external inset.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8803 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
07dbb8fad8
commit
2ca14c025a
@ -1,3 +1,18 @@
|
||||
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
|
||||
|
@ -225,6 +225,7 @@ lyx_SOURCES = \
|
||||
metricsinfo.h \
|
||||
output.C \
|
||||
output.h \
|
||||
outputparams.C \
|
||||
outputparams.h \
|
||||
output_docbook.C \
|
||||
output_docbook.h \
|
||||
|
@ -136,8 +136,6 @@ bool Exporter::Export(Buffer * buffer, string const & format,
|
||||
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, string const & format,
|
||||
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();
|
||||
|
26
src/outputparams.C
Normal file
26
src/outputparams.C
Normal file
@ -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()
|
||||
{}
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user