[LyX/2.5.x] Another take on exit-crash on macOS Tahoe.

Pavel Sanda <[email protected]> Wed, 24 Jun 2026 20:33:11 +0000
Newsgroups gmane.editors.lyx.cvs
Message-ID <[email protected]>
commit 6b33482ce0c03def4fbde7486178f5ab55477e9e
Author: Pavel Sanda <[email protected]>
Date:   Wed Jun 24 22:32:23 2026 +0200

    Another take on exit-crash on macOS Tahoe.
    
    Backports be0260ba78e.
---
 src/frontends/qt/GuiApplication.cpp | 17 +++++------------
 src/frontends/qt/GuiView.h          |  4 ++--
 status.25x                          |  4 ++++
 3 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/src/frontends/qt/GuiApplication.cpp b/src/frontends/qt/GuiApplication.cpp
index 7e54011de8..3e19b24180 100644
--- a/src/frontends/qt/GuiApplication.cpp
+++ b/src/frontends/qt/GuiApplication.cpp
@@ -103,9 +103,6 @@
 #include <QMenuBar>
 #include <QMimeData>
 #include <QObject>
-#if defined(Q_OS_MACOS) && QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
-#include <QOperatingSystemVersion>
-#endif
 #include <QPainter>
 #include <QPixmap>
 #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
@@ -1810,16 +1807,12 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
 		break;
 
 	case LFUN_LYX_QUIT:
-		if (current_view_) {
+		if (current_view_)
 			current_view_->message(from_utf8(N_("Exiting.")));
-			if (!current_view_->closeBufferAll()) {
-				current_view_->message(from_utf8(N_("Cancelled")));
-				break;
-			}
-		}
-		// quitting is triggered by the gui code
-		// (leaving the event loop).
-		QApplication::quit();
+		QTimer::singleShot(0, this, [this]() {
+			if (closeAllViews())
+				quit();
+		});
 		break;
 
 	case LFUN_SCREEN_FONT_UPDATE: {
diff --git a/src/frontends/qt/GuiView.h b/src/frontends/qt/GuiView.h
index 982a54a198..b1c5c310f2 100644
--- a/src/frontends/qt/GuiView.h
+++ b/src/frontends/qt/GuiView.h
@@ -165,8 +165,6 @@ public:
 	bool closeWorkArea(GuiWorkArea * wa);
 	/// closes the buffer
 	bool closeBuffer(Buffer & buf);
-	/// Close all document buffers.
-	bool closeBufferAll();
 
 	///
 	void openDocuments(std::string const & filename, int origin);
@@ -326,6 +324,8 @@ private:
 	void openChildDocument(std::string const & filename);
 	/// Close current document buffer.
 	bool closeBuffer();
+	/// Close all document buffers.
+	bool closeBufferAll();
 	///
 	TabWorkArea * addTabWorkArea();
 
diff --git a/status.25x b/status.25x
index d58a91a6fa..09d2c609d6 100644
--- a/status.25x
+++ b/status.25x
@@ -38,6 +38,10 @@ What's new
 - Simple search within selection now remembers the initial selection
   beyond the first match (bug 13293).
 
+- Fix session information not being properly restored. This regression 
+  introduced was introduced in 2.5.1 as a side effect of fixing macOS
+  crash on exit and new fix should fix both issues.
+
 
 * DOCUMENTATION AND LOCALIZATION
 
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs