Bug 192266

Summary: KConfig doesn't delete a group until the object is destroyed
Product: [Frameworks and Libraries] kdelibs Reporter: Rui Dias <ruijdias>
Component: generalAssignee: David Faure <faure>
Status: RESOLVED FIXED    
Severity: normal CC: faure, julien.michot.fr, kdelibs-bugs, ossi
Priority: NOR    
Version: 4.2   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 4.6
Attachments: Unit test for this bug

Description Rui Dias 2009-05-10 21:23:51 UTC
Version:            (using KDE 4.2.3)
Compiler:          gcc version 4.1.2 (Gentoo 4.1.2 p1.1) 
OS:                Linux
Installed from:    Gentoo Packages

Calling deleteGroup( "somegroup" ) on a KConfig object doesn't delete the group immediately, causing hasGroup( "somegroup" ) to return true.
Comment 1 Rui Dias 2009-05-10 23:41:22 UTC
Created attachment 33529 [details]
Unit test for this bug
Comment 2 David Faure 2010-12-08 23:30:19 UTC
Confirmed, already tested by a unittest I added in 2007, but I hadn't realized the inconsistency in that "creating another KConfig shows it as deleted". Definitely a bug.
Comment 3 David Faure 2010-12-09 01:00:50 UTC
Ok I have a working patch for this, using KEntry::bDeleted for "group marker" entries.
Still leaves two TODOs though:
- what to do if a group is marked as deleted but has non-deleted entries inside (I guess I need to add code to make sure this does not happen, by clearing bDeleted when writing an entry again in the group)
- digging into the test about removing localized entries, which has always failed, but now fails in different ways...
Comment 4 David Faure 2010-12-09 17:40:29 UTC
SVN commit 1204914 by dfaure:

Fix deletion of groups so that a group doesn't exist() after being deleted :-)
A group now exists if it has at least one non-deleted entry (including in subgroups).

+ added unittest for deleting a nested group, and check what gets written to disk.
BUG: 192266
FIXED-IN: 4.6


 M  +54 -32    config/kconfig.cpp  
 M  +3 -0      config/kconfig_p.h  
 M  +10 -6     config/kconfigdata.h  
 M  +8 -3      config/kconfigini.cpp  
 M  +32 -2     tests/kconfigtest.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1204914
Comment 5 Olivier.jg 2010-12-18 06:59:16 UTC
*** Bug 234654 has been marked as a duplicate of this bug. ***