Bug 456046 - Recent files list in GTK apps is emptied randomly and constantly
Summary: Recent files list in GTK apps is emptied randomly and constantly
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.95.0
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: KIO Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-27 17:37 UTC by Riccardo Robecchi
Modified: 2022-09-12 14:33 UTC (History)
5 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Riccardo Robecchi 2022-06-27 17:37:46 UTC
SUMMARY
The recent files list in GTK apps appears to empty itself at random intervals, though it happens constantly. I haven't been able to find a cause nor to understand when exactly this does happen, but the list appears to be always empty when I wake up the laptop from sleep in the morning.
I have noticed this behaviour since Frameworks 5.94 were launched.

STEPS TO REPRODUCE
1. ?

OBSERVED RESULT
The recent files list in GTK apps is empty.

EXPECTED RESULT
The recent files list in GTK apps is not empty.

SOFTWARE/OS VERSIONS
Linux: KDE neon
KDE Plasma Version: 5.25.0
KDE Frameworks Version: 5.95.0
Qt Version: 5.15.4

ADDITIONAL INFORMATION
Comment 1 Nate Graham 2022-06-28 16:24:15 UTC
I suspect our recent change to integrate it might be accidentally deleting the GTK-sourced data, or triggering a pre-existing bug in it. Looping in Méven who worked on this.
Comment 2 Bug Janitor Service 2022-06-29 08:15:20 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/880
Comment 3 Méven Car 2022-06-29 08:17:28 UTC
Since 5.94 KDE Application history is shared with GTK Application (a file opened in gwenview, will be seen in recent files in Gimp for instance)

(In reply to Nate Graham from comment #1)
> I suspect our recent change to integrate it might be accidentally deleting
> the GTK-sourced data, or triggering a pre-existing bug in it. Looping in
> Méven who worked on this.

I am pretty sure, that's it.

This depends on which GTK applications, you use. Vlc does not cause any issue. I can confirm this issue with Gimp.

The dolphin and other kde apps write into  recentlyused.xbel, I made sure to comply with the GTK implementation, but I noticed that whenever the format of the file does not comply exactly with their expectations, GTk implementations wipe the file clean before writing into it.

There is one for time formats already, Gtk expects nano-second time precision, but Qt supports only milliseconds, so I add 000 at the end of the seconds to match Gtk expectation.

I made a fix for the indentation :
https://invent.kde.org/frameworks/kio/-/merge_requests/880

And it works at least with Gimp.
Comment 4 Méven Car 2022-06-29 19:26:59 UTC
Git commit 0dd0e96c10f634974c63f85c2068e44019c27591 by Méven Car, on behalf of Méven Car.
Committed on 29/06/2022 at 19:12.
Pushed by meven into branch 'master'.

KRecentDocuments: Improve indentation in recentlyused.xbel

M  +1    -0    src/core/krecentdocument.cpp

https://invent.kde.org/frameworks/kio/commit/0dd0e96c10f634974c63f85c2068e44019c27591
Comment 5 Riccardo Robecchi 2022-07-28 15:09:06 UTC
The bug appears to still be present as of today on KDE neon.

Plasma version: 5.25.3
KDE Frameworks version: 5.96.0
QT version: 5.15.5
Comment 6 Méven Car 2022-07-30 09:36:16 UTC
(In reply to Riccardo Robecchi from comment #5)
> The bug appears to still be present as of today on KDE neon.
> 
> Plasma version: 5.25.3
> KDE Frameworks version: 5.96.0
> QT version: 5.15.5

Can you find out which application (after dolphin) wiped out the file, or share your ~/.local/share/recently-used.xbel file before after it guests cleared ?
Or at least get steps to reproduce.
Comment 7 Riccardo Robecchi 2022-07-30 09:43:21 UTC
Is there any automated way to discover which application changes the file? I've just checked manually and while the file is populated, applications that use the GTK file picker including GIMP and Firefox (which I manually set to use the GTK picker due to bug 424209) show an empty recent list.
It seems highly likely that the issue is related to GIMP in any case, I will do further testing to confirm this.
Comment 8 Méven Car 2022-07-30 11:22:54 UTC
(In reply to Riccardo Robecchi from comment #7)
> Is there any automated way to discover which application changes the file?
> I've just checked manually and while the file is populated, applications
> that use the GTK file picker including GIMP and Firefox (which I manually
> set to use the GTK picker due to bug 424209) show an empty recent list.
> It seems highly likely that the issue is related to GIMP in any case, I will
> do further testing to confirm this.

I can confirm the file picker is the culprit, having a look...
I didn't test it previously IIRC.
Comment 9 Bug Janitor Service 2022-07-30 12:43:16 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/934
Comment 10 Méven Car 2022-07-31 17:00:08 UTC
Git commit fb34ca9d0a401ac270b597690d08d567dc0a665c by Méven Car, on behalf of Méven Car.
Committed on 31/07/2022 at 16:59.
Pushed by meven into branch 'master'.

KRecentDocument: Improve compat with Gtk File Picker

M  +5    -0    src/core/krecentdocument.cpp

https://invent.kde.org/frameworks/kio/commit/fb34ca9d0a401ac270b597690d08d567dc0a665c
Comment 11 Méven Car 2022-07-31 17:00:16 UTC
Git commit 0690de18b8a64a843c4244103ce1ea7b8b740934 by Méven Car, on behalf of Méven Car.
Committed on 31/07/2022 at 16:59.
Pushed by meven into branch 'master'.

KRecentDocument: better prevent duplicate bookmark for same href

M  +9    -7    src/core/krecentdocument.cpp

https://invent.kde.org/frameworks/kio/commit/0690de18b8a64a843c4244103ce1ea7b8b740934
Comment 12 Méven Car 2022-07-31 17:37:51 UTC
(In reply to Riccardo Robecchi from comment #7)
> Is there any automated way to discover which application changes the file?
> I've just checked manually and while the file is populated, applications
> that use the GTK file picker including GIMP and Firefox (which I manually
> set to use the GTK picker due to bug 424209) show an empty recent list.
> It seems highly likely that the issue is related to GIMP in any case, I will
> do further testing to confirm this.

The bug should be fixed with my latest code change that will be in KF 5.97
Comment 13 Riccardo Robecchi 2022-07-31 18:54:49 UTC
(In reply to Méven Car from comment #12)
> The bug should be fixed with my latest code change that will be in KF 5.97

I will test it once it's out. In the meantime, thank you so much for your help.
Comment 14 Méven Car 2022-08-01 07:14:18 UTC
(In reply to Riccardo Robecchi from comment #13)
> (In reply to Méven Car from comment #12)
> > The bug should be fixed with my latest code change that will be in KF 5.97
> 
> I will test it once it's out. In the meantime, thank you so much for your
> help.

Thank you for the testing and report :)
Comment 15 Riccardo Robecchi 2022-09-12 14:33:21 UTC
I can confirm that the bug has indeed been fixed. Thanks again, Méven!