Description: Solution: Gnome folks say applications should subscribe to Gnome session manager's D-Bus interface to be able to receive "session close" signal and then act accordingly. https://discourse.gnome.org/t/can-ubuntu-prompt-me-to-save-unsaved-documents-during-logout-restart-shutdown/6393 For GTK applications, if "GtkApplication" is used, this is automatic. As Gnome folks say, there's no generic session management across DEs, and other DEs have their own implementations for session managing. I'm guessing, using "GtkApplication" should solve the issue for GTK-based DEs. KDE (and other DEs) needs separate coverage here. (QT-based DEs may have a common solution for this. Don't know.) Steps to Reproduce: LibreOffice 6.4.7.2 OS: Ubuntu 20.04 Gnome 3.36.8 Setup: * Autosave is set to 10 minutes (default) https://i.imgur.com/7CpvjQ7.png Steps: 1) Open Writer and write something 2) Logout from Gnome session >> There's no prompt that there are unsaved changes. See Gedit's prompt: https://i.imgur.com/Jpv0O94.png 3) Login to Gnome 4) Open Writer >> Writer gives the option to recover file 5) Accept Writer's recovering option Actual Results: >> File is empty. Data loss. *FAIL* Expected Results: Expected: No data loss. Reproducible: Always User Profile Reset: Yes Additional Info: I think the solution can be implemented in 2 ways. WAY1: 1) Open Writer and write something 2) Logout from Gnome session >> LibreOffice gets "session close" signal from DE. >> LibreOffice prompts the user about unsaved changes as Gedit can do. 3) User handles the rest. >> No data loss. *SUCCESS* WAY2: 1) Open Writer and write something 2) Logout from Gnome session >> LibreOffice gets "session close" signal from DE. LibreOffice saves session. (autosave) 3) Login to Gnome 4) Open Writer >> Writer gives the option to recover file 5) Accept Writer's recovering option >> File is recovered. *SUCCESS*
Thanks Eren. Reproduced with Ubuntu 20.04, GNOME 3.36.8 and a recent master build: Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: b10417eb1e5a4a6959e7fc1cdd9819e5b09d39a4 CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3 Locale: en-AU (en_AU.UTF-8); UI: en-US Calc: threaded Logging out does not prompt that LO might have unsaved work. Other apps like gedit do. Caolán, is this something you'd be interested in?
Caolán McNamara committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/4a8a24be5a378308680a0b6e2e246d5d9df414c4 Related: tdf#142176 document what the other inhibit options are It will be available in 7.6.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Caolán McNamara committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/796fb57d7b2e2ea05795dc49c4438c25adc26fd4 Related: tdf#142176 rearrange screensaver inhibiter to be more generic It will be available in 7.6.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Caolán McNamara committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/c04d0570b6c8c78e35c2c9b58bf37bb1218021f5 Resolves: tdf#142176 under GNOME inhibit logout if there are modified docs It will be available in 7.6.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Created attachment 187173 [details] screenshot Under gnome we should get the same behavior as gedit now, the prompt that there are unsaved docs as shown in this screenshot
That didn't fix it for me on Ubuntu 20.04 with GNOME 3.36.8 with: Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: 88bd66d258de5fee3d35aba80c61fec49eb2a969 CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3 Locale: en-AU (en_AU.UTF-8); UI: en-US Calc: threaded Some difference in GNOME versions?
With GNOME 43.4 on Fedora 38 I get the above case in the screenshot. If its not working elsewhere then it would need someone to debug the newly added code to see if its getting used at all.
Created attachment 187242 [details] strace when trying to logout but no warning (GNOME 3.36.8) (In reply to Caolán McNamara from comment #7) > With GNOME 43.4 on Fedora 38 I get the above case in the screenshot. If its > not working elsewhere then it would need someone to debug the newly added > code to see if its getting used at all. Here's an strace for when I try to close a Writer document, with no warning in the logout dialog. I noticed something that can maybe give a hint: - If I start Writer, add unsaved edits, then try to log out: no warning - If I start Writer, Help > Restart in safe mode > Restart in normal mode, add unsaved edits, then try to log out: warning in the logout confirmation (with a small delay) So the warning is only triggered after an LO session restart for some reason. I can do a screen capture of that second case if that helps.
Created attachment 187243 [details] strace: no warning -> restart normal mode -> warning (GNOME 3.36.8) Another strace in which I: - start Writer, edit document, try to log out without saving: no warning from GNOME; - restart LO in normal mode, edit document, try to log out without saving: warning from GNOME after small delay.
*** Bug 155765 has been marked as a duplicate of this bug. ***