Fix crash when cutting and pasting include insets with previewing turned on.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7780 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-09-16 21:46:44 +00:00
parent bae615fbf1
commit e2143b91e4
2 changed files with 9 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2003-09-16 Angus Leeming <leeming@lyx.org>
* insetinclude.C (localDispatch): ensure that params_.masterFilename_ is
set before trying to generate a preview, else we trigger an assert.
2003-09-16 Angus Leeming <leeming@lyx.org>
* insetinclude.C (PreviewImpl::parent): return a const reference.

View File

@ -145,8 +145,8 @@ dispatch_result InsetInclude::localDispatch(FuncRequest const & cmd)
InsetInclude::Params p;
InsetIncludeMailer::string2params(cmd.argument, p);
if (!p.cparams.getCmdName().empty()) {
p.masterFilename_ = cmd.view()->buffer()->fileName();
set(p);
params_.masterFilename_ = cmd.view()->buffer()->fileName();
cmd.view()->updateInset(this);
}
return DISPATCHED;
@ -482,7 +482,9 @@ void InsetInclude::validate(LaTeXFeatures & features) const
string incfile(params_.cparams.getContents());
string writefile;
Buffer const & b = *bufferlist.getBuffer(getMasterFilename());
Buffer const * buffer_ptr = bufferlist.getBuffer(getMasterFilename());
BOOST_ASSERT(buffer_ptr);
Buffer const & b = *buffer_ptr;
if (!b.temppath().empty() && !b.niceFile() && !isVerbatim()) {
incfile = subst(incfile, '/','@');
@ -622,7 +624,6 @@ void InsetInclude::PreviewImpl::startMonitoring()
void InsetInclude::PreviewImpl::restartLoading()
{
lyxerr << "restartLoading()" << std::endl;
removePreview();
if (view())
view()->updateInset(&parent());