KConfig::addConfigSources is broken

Andreas Pakulat apaku at gmx.de
Mon Nov 19 10:58:52 GMT 2007


On 18.11.07 22:52:05, Thomas Braxton wrote:
> On 11/18/07, Andreas Pakulat <apaku at gmx.de> wrote:
> > Yeah, actually I don't care which file I have to use in the openConfig()
> > and which file to use in the addConfigSources as long as the symmetry is
> > kept.
> 
> I tested this, and the symmetry is still there. Try my previous
> suggestion and if it still doesn't work, then we have a bug, which
> I'll gladly fix. I don't see how opening one file, then expecting
> writes to go to a different file is symmetrical, or sensible. But, if
> that's the way you want it I can easily change it.

Sorry for not testing it earlier, so I did that switch now and have:

d->m_cfg = KSharedConfig::openConfig( d->developerTempFile );
d->m_cfg->addConfigSources( QStringList() << d->projectTempFile );

KConfigGroup projectGroup( d->m_cfg, "Project" );

QString managerSetting = projectGroup.readEntry( "Manager", "KDevGenericManager" );

And projectTempFile contains the Project group with an entry for
"Manager" thats not "KDevGenericManager"

When I now start KDevelop and let it load the project, I get a happily
cycling KDevelop at 90% CPU, because its using the KDevGenericManager
and not the Manager plugin that is stated in the projectTempFile.

Additionally to that I just found out that, using the original way I
posted, i.e. having the config created from projectTempFile and adding
developerTempFile (though this time the code is using KConfigSkeleton to
create the KConfig object), writing sometimes writes to the right file.
As far as I can see this happens when the group that should be written
to is already in the developerTempFile, when the group either doesn't
exist at all or exists in the projectTempFile the writing goes to the
projectTempFile.

So there might be not just 1 bug around.

Andreas

-- 
You will have long and healthy life.




More information about the kde-core-devel mailing list