From f61e88b7dd85b76e7443a1834766a4e1a4e764d0 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sat, 17 Jun 2017 09:43:01 +0200 Subject: [PATCH] Update parent buffer as soon as a child has been released This prevents dangling pointers that might crash LyX. Fixes: #9979. --- src/BufferList.cpp | 5 +++++ status.22x | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/BufferList.cpp b/src/BufferList.cpp index fd3f19de77..cec9d2d76d 100644 --- a/src/BufferList.cpp +++ b/src/BufferList.cpp @@ -98,10 +98,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(); } } diff --git a/status.22x b/status.22x index 6a06b68d03..eb891c81a5 100644 --- a/status.22x +++ b/status.22x @@ -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 document with dirty child while Document + Settings dialog is open (bug 9979). + - Remove duplicate entries from the Symbols dialog (bug 10644). - Always show the float type in the float inset label (bug 10618). -- 2.39.5