Bug 451712

Summary: 'Discard changes' while editing 'Processes' page also resets columns shown
Product: [Applications] plasma-systemmonitor Reporter: Kishore Gopalakrishnan <kishore96>
Component: generalAssignee: KSysGuard Developers <ksysguard-bugs>
Status: CONFIRMED ---    
Severity: normal CC: ahiemstra, kde, plasma-bugs-null
Priority: NOR    
Version First Reported In: 5.24.3   
Target Milestone: ---   
Platform: Other   
OS: Other   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Kishore Gopalakrishnan 2022-03-20 06:37:13 UTC
SUMMARY
When the user presses 'discard changes' while editing the 'Processes' page, the hide/show states of columns (configured outside edit mode) are unexpectedly reset to default.

STEPS TO REPRODUCE
1. Open System Monitor and go to the 'Processes' page
2. Click 'configure columns' (in the toolbar) and choose to show any column that is currently not shown
3. Now click on the 'three dots' menu on the right of the toolbar and click 'edit page'
4. Click 'Discard changes'

OBSERVED RESULTS
The column added in step 2 is also hidden again

EXPECTED RESULTS
Only the changes made by the user in the current invocation of 'Edit mode' should be discarded.

SOFTWARE VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.24.3
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3
Kernel Version: 5.16.15-arch1-1 (64-bit)
Graphics Platform: X11
Processors: 8 × AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx
Memory: 21.5 GiB of RAM
Graphics Processor: AMD Radeon Vega 8 Graphics

ADDITIONAL INFORMATION
Comment 1 Arjen Hiemstra 2022-04-28 14:30:21 UTC
The configuration for which columns are active is stored in the same location as other page configuration. This is written to disk after some time once values have changed. At the same time, "Discard Changes" forces a reload of the page configuration from disk. If this happens while the previous changes have not been written yet, those changes are lost.

One thing we could try is shortening the timeout for the save timer, which reduces the chance of this happening, though it would still be possible to trigger it.
Comment 2 Kishore Gopalakrishnan 2022-04-28 16:28:23 UTC
(In reply to Arjen Hiemstra from comment #1)
> The configuration for which columns are active is stored in the same
> location as other page configuration. This is written to disk after some
> time once values have changed. At the same time, "Discard Changes" forces a
> reload of the page configuration from disk. If this happens while the
> previous changes have not been written yet, those changes are lost.
> 
> One thing we could try is shortening the timeout for the save timer, which
> reduces the chance of this happening, though it would still be possible to
> trigger it.

Would it make sense to always save the current configuration when the user enters edit mode (before they can make any changes)?