Bug 461448 - Opening a file through the recent files menu breaks the list of recent files
Summary: Opening a file through the recent files menu breaks the list of recent files
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kconfigwidgets
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-05 11:02 UTC by popov895
Modified: 2022-11-12 22:14 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description popov895 2022-11-05 11:02:20 UTC
SUMMARY

Opening a file through the recent files menu removes that file from the recent files list and duplicates the first one.

STEPS TO REPRODUCE

1. Open foo.pdf
2. Open bar.pdf
3. Close both files
4. Recent files list now is [bar.pdf, foo.pdf]
5. Open recent files menu (File > Open Recent) and select foo.pdf
6. Recent files list now is [bar.pdf, bar.pdf]

SOFTWARE/OS VERSIONS

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.26.80
KDE Frameworks Version: 5.100.0
KDE Gear Version: 22.11.70
Qt Version: 5.15.7
Graphics Platform: X11
Comment 1 Bug Janitor Service 2022-11-05 20:10:21 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kconfigwidgets/-/merge_requests/168
Comment 2 Christoph Cullmann 2022-11-12 22:14:01 UTC
Git commit 5aaf0c3e021c9a48b425a0b02212eb699d532177 by Christoph Cullmann, on behalf of Eugene Popov.
Committed on 12/11/2022 at 22:13.
Pushed by cullmann into branch 'master'.

[KRecentFilesAction] Fix broken recent files list

Modifying the list of recent files in the `urlSelected` signal handler (as it happens in Okular: [`Shell::openUrl`](https://invent.kde.org/graphics/okular/-/blob/master/shell/shell.cpp#L332) > [`KRecentFilesAction::addUrl`](https://invent.kde.org/frameworks/kconfigwidgets/-/blob/master/src/krecentfilesaction.cpp#L177) > [`KRecentFilesAction::removeUrl`](https://invent.kde.org/frameworks/kconfigwidgets/-/blob/master/src/krecentfilesaction.cpp#L232) > [`KRecentFilesActionPrivate::removeAction`](https://invent.kde.org/frameworks/kconfigwidgets/-/blob/master/src/krecentfilesaction.cpp#L103)) can cause the iterator used when emitting that signal to become invalid.

M  +2    -1    src/krecentfilesaction.cpp

https://invent.kde.org/frameworks/kconfigwidgets/commit/5aaf0c3e021c9a48b425a0b02212eb699d532177