mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 19:59:46 +00:00
Update parent buffer as soon as a child has been released
This prevents dangling pointers that might crash LyX. Fixes: #9979.
This commit is contained in:
parent
e5105a0dce
commit
f61e88b7dd
@ -98,10 +98,15 @@ void BufferList::release(Buffer * buf)
|
|||||||
BufferStorage::iterator const it =
|
BufferStorage::iterator const it =
|
||||||
find(bstore.begin(), bstore.end(), buf);
|
find(bstore.begin(), bstore.end(), buf);
|
||||||
if (it != bstore.end()) {
|
if (it != bstore.end()) {
|
||||||
|
Buffer const * parent = buf ? buf->parent() : 0;
|
||||||
Buffer * tmp = (*it);
|
Buffer * tmp = (*it);
|
||||||
bstore.erase(it);
|
bstore.erase(it);
|
||||||
LASSERT(tmp, return);
|
LASSERT(tmp, return);
|
||||||
delete tmp;
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,6 +71,9 @@ What's new
|
|||||||
|
|
||||||
- Fix crash when closing master file with full view source open (bug 10560).
|
- Fix crash when closing master file with full view source open (bug 10560).
|
||||||
|
|
||||||
|
- Fix crash when closing master document with dirty child while Document
|
||||||
|
Settings dialog is open (bug 9979).
|
||||||
|
|
||||||
- Remove duplicate entries from the Symbols dialog (bug 10644).
|
- Remove duplicate entries from the Symbols dialog (bug 10644).
|
||||||
|
|
||||||
- Always show the float type in the float inset label (bug 10618).
|
- Always show the float type in the float inset label (bug 10618).
|
||||||
|
Loading…
Reference in New Issue
Block a user