Bug 409858 - Working file sets on load create text document objects for no longer existing or not yet opened files (e.g. shown in Documents toolview)
Summary: Working file sets on load create text document objects for no longer existing...
Status: RESOLVED FIXED
Alias: None
Product: kdevplatform
Classification: Developer tools
Component: shell (show other bugs)
Version: 5.3.2
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-16 14:09 UTC by Friedrich W. H. Kossebau
Modified: 2021-05-24 12:03 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Friedrich W. H. Kossebau 2019-07-16 14:09:57 UTC
Loading some older KDevelop sessions, one sometimes can see documents listed in the "Documents" tool view which no longer exist or which have not yet been opened in the current session (i.e. where no view is currently shown).

Next to that there are also warnings triggered in the log, like
--- 8< ---
kdevplatform.shell: Broken text-document:  QUrl("file:///home/koder/projects/foo/src/main.cpp")
kdevplatform.shell: Broken text-document:  QUrl("file:///tmp/kdevelop_f18822.patch")
--- 8< ---
e.g. when the ProblemReporter toolview gets triggered on document view switch to update its view and in ProblemReporterPlugin::updateOpenedDocumentsHighlight() iterates over all document objects and does some sanity check with KDevelop::TextDocument::isTextDocument(), which then triggers those warnings.

Looking at the sessionrc file of such a session, one can see those files being listed as part of the data of a working file set, e.g.
--- 8< ---
[Working File Sets][review_5752676|Review]
Active View=file:///tmp/kdevelop_f18822.patch
View 0=file:///tmp/kdevelop_f18822.patch
View 1=file:///home/koder/projects/foo/src/main.cpp
View Count=2
--- 8< ---

Dumping findings here for now, myself yet needs to wrap brain around working sets code & design one day...
Comment 1 Christoph Roick 2021-05-24 12:03:47 UTC
Git commit d2b8dc325abc99b4931598258bf052d06a2440d2 by Christoph Roick.
Committed on 23/05/2021 at 11:28.
Pushed by croick into branch 'master'.

Do not try to reopen non-existing local files

M  +17   -7    kdevplatform/shell/tests/test_workingsets.cpp
M  +7    -0    kdevplatform/shell/tests/test_workingsets.h
M  +13   -4    kdevplatform/shell/workingsets/workingset.cpp

https://invent.kde.org/kdevelop/kdevelop/commit/d2b8dc325abc99b4931598258bf052d06a2440d2