https://bugs.kde.org/show_bug.cgi?id=466553

            Bug ID: 466553
           Summary: Switching sessions when a file has been modified or
                    deleted creates mixed session
    Classification: Applications
           Product: kate
           Version: 22.12.2
          Platform: openSUSE
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: sessions
          Assignee: kwrite-bugs-n...@kde.org
          Reporter: groszdaniel...@gmail.com
  Target Milestone: ---

SUMMARY
If an open file has been modified in Kate and/or deleted on disk, and you
switch sessions, Kate asks you to confirm. If you click Cancel, Kate proceeds
with opening the session you chose anyway. However, the files that were already
open remain open according to the Documents sidebar, and get added to the newly
opened session.

Switching back-and-forth in this manner can even result in the same file being
open multiple times, independently.

STEPS TO REPRODUCE
1. Open some files, and save the session (Session 1).
2. Delete some of the open files on disk. (Alternatively, modify some files.)
3. Open another session from Sessions/Recent Sessions (Session 2).
4. When Kate asks "The file '...' was deleted on disk. Do you really want to
continue to close this file? Data loss may occur.", click Cancel. (If you both
modified some files and deleted them on disk, Kate first asks if you want
Overwrite, Reload or Ignore Changes; then it asks if you want to Save, Discard
or Cancel, choose Cancel.)

OBSERVED RESULT
Kate opens the files from Session 2, but files from Session 1 stay in the list
of open files in the Documents sidebar, without being associated with any tab.
Even if you quit Kate, and then start it again and choose Session 2, the files
from Session 1 are opened too. If you open such a file from the Documents
sidebar, it gets opened in a tab, and its contents are preserved if you haven't
quit Kate and started it again, but if you did, and it's a file that was
deleted on disk and not modified in Kate, it's opened as an empty file.

EXPECTED RESULT
Kate cancels the operation entirely. Session 1 remains open, and Session 2
isn't opened.

If the deleted files are not modified, it's also acceptable to close them
without asking for confirmation. That's what happens if you delete a file on
the disk that's open and not modified, and then close Kate without focusing the
file's editor tab in the meantime.

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20230226
KDE Plasma Version: 5.27.1
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.1.8-1-default (64-bit)
Graphics Platform: X11

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to