commit 2c3e96a1d084d37592e8c5164aec3809c5352ec3
Author: Juergen Spitzmueller <[email protected]>
Date:   Sat Jul 5 15:48:24 2025 +0200

    Fix loss of last open files after crash (#12374)
    
    This only happened if an additional file had been opened
    during the current session.
    
    (cherry picked from commit 53aa2f15c2e90d28519e3cb6a50af0ea73d6ecec)
---
 src/frontends/qt/GuiView.cpp | 10 ++++++++--
 status.24x                   |  2 ++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index f3859ea653..23259a77ca 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -2921,8 +2921,13 @@ Buffer * GuiView::loadDocument(FileName const & 
filename, bool tolastfiles)
 
        if (tolastfiles) {
                theSession().lastFiles().add(filename);
+               // refresh last opened list before writing
+               // otherwise we end up with an empty list
+               // when we crash (#12374)
+               theSession().lastOpened().clear();
+               writeSession();
                theSession().writeFile();
-  }
+       }
 
        return newBuffer;
 }
@@ -3657,7 +3662,8 @@ bool GuiView::closeBuffer()
 }
 
 
-void GuiView::writeSession() const {
+void GuiView::writeSession() const
+{
        GuiWorkArea const * active_wa = currentMainWorkArea();
        for (int i = 0; i < d.splitter_->count(); ++i) {
                TabWorkArea * twa = d.tabWorkArea(i);
diff --git a/status.24x b/status.24x
index 95fb1874af..78636c8980 100644
--- a/status.24x
+++ b/status.24x
@@ -52,6 +52,8 @@ What's new
 
 - Fix problem when using DeclarePairedDelimiterX (bug 8934).
 
+- Fix reconstruction of last opened documents after crash (bug 12374).
+
 
 * USER INTERFACE
 
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to