Steps to reproduce: 1. With no project open, open some files 2. Open project A 3. Without closing project A first, open project B 4. Close project B 5. The originally open files from (1) are gone
The problem is that when project A closes and all its files are closed, load_config() gets called which contains
configuration_save_default_session();
This saves the session with all files closed and replaces the original session.
This patch modifies the code to call configuration_save_default_session() only when there are some open tabs so the above problem gets solved.
Even though I was worried that this would break saving default session when all its files get closed and then a project is loaded, it doesn't seem to be the case (I haven't investigated deep enough why).
An alternative to this approach would be to pass a boolean as a parameter of quite many functions and propagate the information whether project close preceded its opening but it introduces a much bigger diff and makes the complicated session opening stuff even wilder.
Fixes #3897. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/3898
-- Commit Summary --
* Fix a problem when multiple project opens clear the default session
-- File Changes --
M src/project.c (3)
-- Patch Links --
https://github.com/geany/geany/pull/3898.patch https://github.com/geany/geany/pull/3898.diff