Re: Session restore not working in 2.5.1?

Pavel Sanda <[email protected]> Tue, 12 May 2026 18:15:56 +0200
Newsgroups gmane.editors.lyx.devel
Message-ID <[email protected]>
On Thu, Apr 23, 2026 at 04:41:17PM +0100, José Matos wrote:
> Hi all,
>   I noticed that the session restore does not seem to be working in 2.5.1:
> 
> Version 2.5.1
> (Sunday, 12 April 2026)
> 
> Qt Version (run-time): 6.10.3 on platform wayland
> Qt Version (compile-time): 6.10.2
> OS Version (run-time): Fedora Linux 44 (KDE Plasma Desktop Edition)
> Python detected: 3.14.4 (/usr/bin/python3)
> Draw strategy: partial draw on backing store
> 
> For me it is as simple as closing LyX and repoening it an the files are no
> longer opened on start.
> 
> This did not happen with 2.5.0.
> The preferences are the same, BTW.
> 
> Where can I search for the causes of this behaviour?

:)

Hi Claude, you are in lyx repo in 2.5 branch. can you look what might be the reasons
during 2.5.0 .. 2.5.1 window for the report above?

"
I found the regression. The commit responsible is 8ed3745da4 ("fixup 3b6ec13d: better fix for SIGABRT at exiting time on macOS Tahoe", cherry-picked from
  master b5ae004aa2).

  What it changed (src/frontends/qt/GuiApplication.cpp, LFUN_LYX_QUIT):

  In 2.5.0 the quit path was:

  if (closeAllViews())
      quit();

  closeAllViews() (in GuiApplication.cpp:3208) calls view->closeScheduled() for each view, which sets closing_ = true and triggers close(). Qt then delivers
  GuiView::closeEvent() (GuiView.cpp:1412), which - because closing_ is true - skips the lastOpened().clear() and crucially calls writeSession()
  (GuiView.cpp:1432). writeSession() (GuiView.cpp:3791) walks the work areas and adds every open buffer to theSession().lastOpened(). Later
  LyX::execBatchCommands flushes that list to disk via session_->writeFile() (src/LyX.cpp:408).

  In 2.5.1 it is now:

  if (current_view_) {
      current_view_->message(...);
      if (!current_view_->closeBufferAll()) { ... break; }
  }
  QApplication::quit();

  GuiView::closeBufferAll() (GuiView.cpp:3805) saves dirty buffers, then calls closeWorkAreaAll() on every view - but it never calls writeSession() and never
  sets closing_ = true. By the time QApplication::quit() triggers any subsequent closeEvent, the work areas are already gone, and the !closing_ branch in
  closeEvent runs lastOpened().clear() over an empty list. The session file is written empty, so nothing reopens on next launch.

  The fix is straightforward: have the new LFUN_LYX_QUIT path call writeSession() (and probably preserve the closing_ / lastOpened().clear() semantics) before
  tearing down work areas - e.g. call writeSession() on each view right before closeBufferAll(), or move the session-write logic into closeBufferAll() itself.

  That matches the report exactly: same prefs, 2.5.0 reopens files, 2.5.1 does not, regardless of platform (it was a macOS Tahoe SIGABRT fix but the rewrite
  affects every OS).

- Cooked for 1m 59s
"

P
-- 
lyx-devel mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-devel