Fix bug 5699 (crash when using outliner in child document while the master is not opened).

The problem was that, if the master is not opened, no respective guiDelegate exists, and the functions that update the toc do not trigger. The fix is to update the child's toc backend and toc items directly in such cases. 


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28551 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2009-02-19 00:29:04 +00:00
parent c85e24b066
commit 0aca981637
3 changed files with 17 additions and 0 deletions

View File

@ -2287,6 +2287,12 @@ void Buffer::resetAutosaveTimers() const
}
bool Buffer::hasGuiDelegate() const
{
return gui_;
}
void Buffer::setGuiDelegate(frontend::GuiBufferDelegate * gui)
{
gui_ = gui;
@ -2719,6 +2725,10 @@ void Buffer::updateLabels(bool childonly) const
if (master != this) {
bufToUpdate.insert(this);
master->updateLabels(false);
// Do this here in case the master has no gui associated with it. Then,
// the TocModel is not updated and TocModel::toc_ is invalid (bug 5699).
if (!master->gui_)
structureChanged();
// was buf referenced from the master (i.e. not in bufToUpdate anymore)?
if (bufToUpdate.find(this) == bufToUpdate.end())

View File

@ -442,7 +442,10 @@ public:
///
void message(docstring const & msg) const;
///
void setGuiDelegate(frontend::GuiBufferDelegate * gui);
///
bool Buffer::hasGuiDelegate() const;
///
void autoSave() const;

View File

@ -2211,6 +2211,10 @@ void Cursor::checkBufferStructure()
{
Buffer const * master = buffer()->masterBuffer();
master->tocBackend().updateItem(*this);
if (master != buffer() && !master->hasGuiDelegate())
// In case the master has no gui associated with it,
// the TocItem is not updated (part of bug 5699).
buffer()->tocBackend().updateItem(*this);
}