]> git.lyx.org Git - features.git/commitdiff
Update parent buffer as soon as a child has been released
authorJuergen Spitzmueller <spitz@lyx.org>
Sat, 17 Jun 2017 07:43:01 +0000 (09:43 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 17 Jul 2017 08:34:58 +0000 (10:34 +0200)
This prevents dangling pointers that might crash LyX.

Fixes: #9979.
src/BufferList.cpp
status.22x

index fd3f19de77c6f65dbeff18e0852105a9d5650c30..cec9d2d76d7910f0510813929bb1b200163469a4 100644 (file)
@@ -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();
        }
 }
 
index 6a06b68d03049f39023771a7c461ed17b915d9af..eb891c81a5e8efd641d1650667a9dd155fa4fe0d 100644 (file)
@@ -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).