Bug 491861 - If system crashes Krusader doesn't save session
Summary: If system crashes Krusader doesn't save session
Status: RESOLVED FIXED
Alias: None
Product: krusader
Classification: Applications
Component: general (other bugs)
Version First Reported In: 2.8.1
Platform: Arch Linux Linux
: NOR wishlist
Target Milestone: ---
Assignee: Krusader Bugs Distribution List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-08-18 13:29 UTC by yellow.cat87355
Modified: 2024-11-27 10:42 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description yellow.cat87355 2024-08-18 13:29:48 UTC
***
If you're not sure this is actually a bug, instead post about it at https://discuss.kde.org

If you're reporting a crash, attach a backtrace with debug symbols; see https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***

SUMMARY
If krusader doesn't exit clean, it doesn't remember the current session.

STEPS TO REPRODUCE
1. Open kusader and change to a different directory.
2. Kill krusader ($killall krusader)
3. Reopen krusader

OBSERVED RESULT
When reopening krusader, it doesn't remember the directory change.

EXPECTED RESULT
Krusader tracks changes made during a session and would open back up where you left off after an unexpected closure. 

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.1.4
KDE Frameworks Version: 6.4.0
Qt Version: 6.7.2
Kernel Version: 6.10.4-arch2-1 (64-bit)
Graphics Platform: X11


ADDITIONAL INFORMATION
Would love to see the same basic behavior of a browser that has crashed and would ask to restore your tabs when reopening. I'm experiencing a nasty system bug right now and I have to keep closing and reopening krusader to lock in my changes. At a minimum, a save session button/shortcut would be better than nothing.
Comment 1 Pedro V 2024-09-25 01:02:11 UTC
This is more of an unimplemented feature problem than a bug, so importance is likely to be more appropriate as "wishlist".

Guess part of your wish is already granted, the "Save Position" keyboard shortcut seems to dump the current state in general, although I haven't tested it extensively with multiple tabs and various settings changes.
Apparently the same functionality is available in the menu as Window -> Save Position too.

I'm generally supportive of the idea, but beware of corner cases: Krusader explicitly supports multiple instances by default, and to avoid gambling with the saved state, exit should either check the saved state, or it should unconditionally do a save.
For example I rarely open a secondary Krusader when the primary one is busy with some very long running I/O task, potentially being completely frozen due to an unresponsive mount point. In this case I would be quite confused if I'd exit from the secondary first, then from the primary, but I'd have the secondary state saved just because the primary figured that the state didn't change since the last auto save.
Comment 2 yellow.cat87355 2024-09-25 13:25:48 UTC
Thanks for the information!

I come to krusader after more than a decade of thunar, so it's taken a while to adapt to the differences. In general, I find it a much more capable. I never gave much thought about restoring sessions before because it never seemed to be an issue with thunar. It just worked as expected.

As for your example about multiple instances, I've run into that more than once with my browser, so I don't think there is any easy logic to adopt that would cover all cases. I'd have my main browser open with my normal tab and tab groups, then would open another instance and forget about it. Then when I'd close my main browser and discover the forgotten window, I'd lose all my saved tabs and tab groups. My workaround was a session manager extension to restore my session history. (Session Buddy)

I only ever use a single instance of krusader, so my "wishlist" scenario would be to offer session restore as an option for single instance use only. This way it doesn't change the current functionality at all for multi instance use. I suppose you could also follow the same strategy as my browser extension to cover every scenario by providing a list of recent session snapshots to restore, but that sounds like it may be getting into dreamlist territory. :P

I'll try and remember to use the shortcut from time to time for now and hope this gets added to the roadmap. 

Cheers
Comment 3 Alex Bikadorov 2024-11-01 12:00:37 UTC
Addressed with https://invent.kde.org/utilities/krusader/-/merge_requests/151
Comment 4 Alex Bikadorov 2024-11-27 10:42:13 UTC
Git commit 03fe3ae3991fb7d2945fa68135765e0375f16cde by Alex Bikadorov, on behalf of Alexander Bikadorov.
Committed on 27/11/2024 at 10:40.
Pushed by abikadorov into branch 'master'.

Use KCrash to handle crashes and save settings on crash and signals received

ADDED: Save settings on crash and when signals are received

M  +1    -0    CMakeLists.txt
M  +1    -0    app/CMakeLists.txt
M  +9    -0    app/krusader.cpp
M  +1    -0    app/krusader.h
M  +20   -7    app/main.cpp

https://invent.kde.org/utilities/krusader/-/commit/03fe3ae3991fb7d2945fa68135765e0375f16cde