Bug 509673

Summary: Newly-created activities only show up after reopening the KCM
Product: [Applications] systemsettings Reporter: David Redondo <kde>
Component: kcm_activitiesAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: ivan.cukic, kde, nate, nicolas.fella
Priority: HI Keywords: regression
Version First Reported In: 6.4.80   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 6.4.91
Sentry Crash Report:

Description David Redondo 2025-09-19 10:32:54 UTC
SUMMARY
When creating activities they only show up after reopening the kcm

STEPS TO REPRODUCE
1. Add new activity
2.  click save

OBSERVED RESULT
New activity not shown

EXPECTED RESULT
acitvity shown

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: neon
KDE Plasma Version: master
KDE Frameworks Version: master
Qt Version:  6.9.2
Comment 1 David Redondo 2025-09-19 12:48:41 UTC
Seems they also do not persist between log ins
Comment 2 Nate Graham 2025-09-19 19:05:23 UTC
With today's git master, I can reproduce the KCM issue, but for me, newly-created activities do show up on re-login. Let's use this to track the KCM issue.
Comment 3 Nicolas Fella 2025-09-21 09:32:43 UTC
ugh, it seems to work _sometimes_?
Comment 4 Nicolas Fella 2025-09-21 09:47:18 UTC
This seems to be caused by https://invent.kde.org/plasma/plasma-activities/-/commit/e5c46ac3c99ff1f078b0c461498652a55b2ebf85

The index where the new activity is inserted (https://invent.kde.org/plasma/plasma-activities/-/blob/master/src/imports/activitymodel.cpp#L385) sometimes has nonsensical values like 4294047598
Comment 5 Bug Janitor Service 2025-09-21 09:48:34 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-activities/-/merge_requests/66
Comment 6 Bug Janitor Service 2025-09-21 11:26:07 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-activities/-/merge_requests/67
Comment 7 Waqar Ahmed 2025-09-23 09:37:46 UTC
Git commit bfb8ac19f1d53e40a114e4f12d9f3537261e59e3 by Waqar Ahmed.
Committed on 21/09/2025 at 11:25.
Pushed by davidedmundson into branch 'master'.

Fix broken QFlatSet insertion

- Use the iterator returned from insert() instead of reusing the
existing iterator because it might be invalidated
- dont cache begin(), end(). They make it very easy to write wrong code
because begin()/end() might be different post insertion.

M  +5    -0    autotests/core/CMakeLists.txt
A  +54   -0    autotests/core/QFlatSetTest.cpp  *
M  +6    -8    src/utils/qflatset.h

The files marked with a * at the end have a non valid license. Please read: https://community.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.


https://invent.kde.org/plasma/plasma-activities/-/commit/bfb8ac19f1d53e40a114e4f12d9f3537261e59e3
Comment 8 Nicolas Fella 2025-09-23 09:47:09 UTC
Git commit 60229e33f8b1a69256226e2eb8dbe315aaa35cd9 by Nicolas Fella, on behalf of Waqar Ahmed.
Committed on 23/09/2025 at 09:46.
Pushed by nicolasfella into branch 'Plasma/6.5'.

Fix broken QFlatSet insertion

- Use the iterator returned from insert() instead of reusing the
existing iterator because it might be invalidated
- dont cache begin(), end(). They make it very easy to write wrong code
because begin()/end() might be different post insertion.
(cherry picked from commit bfb8ac19f1d53e40a114e4f12d9f3537261e59e3)

M  +5    -0    autotests/core/CMakeLists.txt
A  +54   -0    autotests/core/QFlatSetTest.cpp  *
M  +6    -8    src/utils/qflatset.h

The files marked with a * at the end have a non valid license. Please read: https://community.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.


https://invent.kde.org/plasma/plasma-activities/-/commit/60229e33f8b1a69256226e2eb8dbe315aaa35cd9