mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-21 23:09:40 +00:00
Update parent buffer as soon as a child has been released
This prevents dangling pointers that might crash LyX. Fixes: #9979. Candidate for stable.
This commit is contained in:
parent
7a9bb85184
commit
cde5d60fcf
@ -96,10 +96,15 @@ void BufferList::release(Buffer * buf)
|
||||
BufferStorage::iterator const it =
|
||||
find(bstore.begin(), bstore.end(), buf);
|
||||
if (it != bstore.end()) {
|
||||
Buffer const * parent = buf ? buf->parent() : 0;
|
||||
Buffer * tmp = (*it);
|
||||
bstore.erase(it);
|
||||
LASSERT(tmp, return);
|
||||
delete tmp;
|
||||
if (parent)
|
||||
// If this was a child, update the parent's buffer
|
||||
// to avoid crashes due to dangling pointers (bug 9979)
|
||||
parent->updateBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user