mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 05:55:34 +00:00
If a file is saved as, reset its master if it has any, thus preventing a crash (bug 8161)
This commit is contained in:
parent
c3fef458c7
commit
993fa89009
@ -4417,6 +4417,7 @@ bool Buffer::saveAs(FileName const & fn)
|
|||||||
// we need to check that the locations of child buffers
|
// we need to check that the locations of child buffers
|
||||||
// are still valid.
|
// are still valid.
|
||||||
checkChildBuffers();
|
checkChildBuffers();
|
||||||
|
checkMasterBuffer();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
// save failed
|
// save failed
|
||||||
@ -4465,4 +4466,25 @@ void Buffer::checkChildBuffers()
|
|||||||
d->position_to_children.clear();
|
d->position_to_children.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// If a child has been saved under a different name/path, it might have been
|
||||||
|
// orphaned. Therefore the master needs to be reset (bug 8161).
|
||||||
|
void Buffer::checkMasterBuffer()
|
||||||
|
{
|
||||||
|
Buffer const * const master = masterBuffer();
|
||||||
|
if (master == this)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// necessary to re-register the child (bug 5873)
|
||||||
|
// FIXME: clean up updateMacros (here, only
|
||||||
|
// child registering is needed).
|
||||||
|
master->updateMacros();
|
||||||
|
// (re)set master as master buffer, but only
|
||||||
|
// if we are a real child
|
||||||
|
if (master->isChild(this))
|
||||||
|
setParent(master);
|
||||||
|
else
|
||||||
|
setParent(0);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace lyx
|
} // namespace lyx
|
||||||
|
@ -662,6 +662,8 @@ public:
|
|||||||
WordLangTuple & word_lang, docstring_list & suggestions) const;
|
WordLangTuple & word_lang, docstring_list & suggestions) const;
|
||||||
///
|
///
|
||||||
void checkChildBuffers();
|
void checkChildBuffers();
|
||||||
|
///
|
||||||
|
void checkMasterBuffer();
|
||||||
|
|
||||||
/// compute statistics between \p from and \p to
|
/// compute statistics between \p from and \p to
|
||||||
/// \p from initial position
|
/// \p from initial position
|
||||||
|
@ -97,6 +97,9 @@ What's new
|
|||||||
|
|
||||||
* DOCUMENT INPUT/OUTPUT
|
* DOCUMENT INPUT/OUTPUT
|
||||||
|
|
||||||
|
- Fix crash when saving a child document to a new name/directory and attempting
|
||||||
|
to view/export the document afterwards (bug 8161).
|
||||||
|
|
||||||
- Fixed an infinite loop when exporting a file with list
|
- Fixed an infinite loop when exporting a file with list
|
||||||
or bibliography environments to DocBook (bug 7914).
|
or bibliography environments to DocBook (bug 7914).
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user