Bug 382749

Summary: corona->importLayout() new strange behavior, subject of broken configurations
Product: [Frameworks and Libraries] libplasma Reporter: Michail Vourlakos <mvourlakos>
Component: libplasmaAssignee: Marco Martin <notmart>
Status: RESOLVED NOT A BUG    
Severity: normal    
Priority: NOR    
Version First Reported In: 5.36.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Michail Vourlakos 2017-07-26 12:39:24 UTC
Hello,

I have two issues with corona->importLayout() which I think I didnt have in the past. we use this function in the upcoming Latte in order to copy a dock. (a dock is a containment containing applets).

We copy the dock  configuration we want in a new file and from that new file we use the importLayout in order to load the copied dock.

1. In the past the importLayout function was updating also the applet ids when it was used. Now even though it updates the containment id, the applet ids remain the same. That creates a crash of course when removing the copied dock. We workaround this by changing the ids by ourselves and providing unique ids for containments and applets that arent used yet. This of course includes also the settings updating and the systray case

2. Even though the above (1) doesnt create crashes anymore, we observed a very strange behavior that may be irrelevant of (1). the importLayout creates double references to applets. For example if a containment contains two applets with ids(40, 45). The importLayout returns a contaiment that contains 4 applets with ids (40, 40, 45, 45). It is like it double loads the applets
Comment 1 Michail Vourlakos 2017-07-27 13:02:29 UTC
issue (2) is not relevant to importLayout. importLayout works correctly!

the (2) issue is tracked down to containment's restoreContents() which is called through restore(KConfigGroup). The restoreContents function doesnt remove the loaded applets before importing the new ones. So it doubles loading the same applets.
Comment 2 Michail Vourlakos 2017-07-27 13:39:15 UTC
(2) was totally our fault how we were loading the new copied containments... for (1) I dont know if this is the current default plasma behavior (meaning that the applet ids dont have to be updated)...