mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
Fix crash when closing master with children and grandchildren
In some cases, it is possible that the BufferPositionMap has
dangling pointers. We thus check whether the Buffer is loaded
before accessing it.
Fixes: #10766
(cherry picked from commit 4f50cbcfe4
)
This commit is contained in:
parent
9df59aac63
commit
a18ad654e8
@ -3720,8 +3720,12 @@ void Buffer::listMacroNames(MacroNameSet & macros) const
|
||||
// loop over children
|
||||
Impl::BufferPositionMap::iterator it = d->children_positions.begin();
|
||||
Impl::BufferPositionMap::iterator end = d->children_positions.end();
|
||||
for (; it != end; ++it)
|
||||
it->first->listMacroNames(macros);
|
||||
for (; it != end; ++it) {
|
||||
Buffer * child = const_cast<Buffer *>(it->first);
|
||||
// The buffer might have been closed (see #10766).
|
||||
if (theBufferList().isLoaded(child))
|
||||
child->listMacroNames(macros);
|
||||
}
|
||||
|
||||
// call parent
|
||||
Buffer const * const pbuf = d->parent();
|
||||
|
Loading…
Reference in New Issue
Block a user