Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong tabs are restored after a system restart #1294

Closed
2 of 3 tasks
vikasnataraja opened this issue Apr 24, 2020 · 10 comments · Fixed by #1833
Closed
2 of 3 tasks

Wrong tabs are restored after a system restart #1294

vikasnataraja opened this issue Apr 24, 2020 · 10 comments · Fixed by #1833
Labels
Needs Design Waiting for input from the UX team

Comments

@vikasnataraja
Copy link

Prerequisites

  • I have searched open and closed issues for duplicates.

Describe the bug

After I restart my computer, the wrong tabs are restored. It seems to restore tabs that I was using about 3 or 4 weeks ago and this occurs after every restart (i.e. after very restart, the exact same set of tabs are restored)

To Reproduce

Steps to reproduce the behavior:

  1. Go to Files
  2. Open a bunch of tabs
  3. Restart computer
  4. See error

Expected behavior

The correct tabs i.e tabs that were being used right before the restart must be restored.

Platform Information

  • I'm using the latest version from git that I've manually compiled
  • I'm using the latest released stable version
@jeremypw
Copy link
Collaborator

The only explanation for this I can think of is that, for some reason the last in use tabs are not being saved to settings when Files closes (they are not updated on the fly). How do you close Files? I am not finding this problem using the latest version of Files.

@jeremypw
Copy link
Collaborator

If you have turned off "Remember History" for the last 3 - 4 weeks and just turned it back on then on the first start up the tabs you were using 3 - 4 weeks ago will be restored. However Files should subsequently restore the latest tabs, unless you have turned off the "restore-tabs" setting, in which case it will start at your home directory.

@jeremypw
Copy link
Collaborator

It seems that if you log out without closing Files then the current tabs are not saved either. Looks like the system force closes the apps without allowing them to clean up :-(

@jeremypw
Copy link
Collaborator

Looks like Code get around this by inserting a handler for the Unix SIGTERM and SIGINT signals that calls the "quit" action of the app. I guess this should be replicated in Files.

@jeremypw jeremypw added the Status: In Progress A related pull request is being worked on label Apr 24, 2020
@jeremypw
Copy link
Collaborator

Correction: Code saves open tabs on the fly. Handling SIGTERM/SIGINT does not work for logging out - uses SIGKILL (which cannot be caught)?

@jeremypw jeremypw added Needs Design Waiting for input from the UX team and removed Status: In Progress A related pull request is being worked on labels Apr 24, 2020
@jeremypw
Copy link
Collaborator

Looks like all apps failed to save their state if closed (killed) by logging out - so the only solution is saving state on the fly. Files is different from Code in that it is possible to navigate to different locations in the same tab but there is a 1:1 relation between documents and tabs in Code so there is less change. Seeking design input on whether we want Files to save tab/location state on the fly.

@vikasnataraja
Copy link
Author

I believe Terminal also saves states on the fly. Even if I restart abruptly i.e by not closing the apps first, it always restores my tabs correctly. Files, however, doesn't seem to do that.

@jeremypw
Copy link
Collaborator

Even if all elementary apps save state on the fly, it is probable that many (most?) 3rd party apps won't so its always going to be safer to close all windows before logging out. Unless the logout code can be changed to close the windows properly?

@jeremypw
Copy link
Collaborator

Just noticed that there is already an (elderly) issue about this at elementary/quick-settings#42

@follower
Copy link

Also related:

Also, if I recall correctly, another variant of this issue is that tabs in multiple Files windows are not handled correctly--which ever window is closed last overwrites the state.

time passes

Actually, from looking at the code it seems the only saving tabs for one window behaviour is...intentional?

files/src/View/Window.vala

Lines 906 to 910 in 1e6842f

public void quit () {
if (is_first_window) {
save_geometries ();
save_tabs ();
}

(Although I am curious if how "first window" is determined has changed over time...)

Maybe saving tabs for all open windows on quit (+restore) needs a separate issue?

To me, not saving tabs in all windows on application exit is both non-obvious and non-useful behaviour.

Related commits:

Also:

files/src/View/Window.vala

Lines 976 to 980 in 1e6842f

public uint restore_tabs () {
/* Do not restore tabs if history off nor more than once */
if (!Files.Preferences.get_default ().remember_history || tabs_restored || !is_first_window) {
return 0;
} else {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Design Waiting for input from the UX team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants