KConfigGroup parent() and isValid()

Aaron J. Seigo aseigo at kde.org
Fri Sep 19 12:06:41 BST 2014


KConfigGroup parent() currently always returns a KConfigGroup object with a 
dptr. isValid() determines validity based on having a dptr. this leads to 
loops like this:

KConfigGroup group = <some valid group>;
while (group.isValid()) {
	group = group.parent();

to never terminate, as parent() returns the top level group forever (name = 
"<default>"). this is because, due to the behavior of parent(), the top level 
group is its own parent.

is it intended that the parent of the default group is itself?

this would not be so much of a problem is there was a way to test for the 
group being the top level group without hardcoding magic literal strings like 
"<default>" into the code.

Aaron J. Seigo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20140919/3c26b6b1/attachment.sig>

More information about the kde-core-devel mailing list