[PyQt] PyKDE segfaults when calling group() on KSharedConfig object

Andreas Pakulat apaku at gmx.de
Thu Feb 19 21:54:57 GMT 2009


On 19.02.09 21:54:59, Simon Edwards wrote:
> Hi,
>
> Benno Dielmann wrote:
>> thanks, Simon, for looking into this and in general for your great work 
>> on PyKDE :-). 
>>
>> I'm using KGlobal.config() in my application now. What is the 
>> difference between this and KSharedConfig.openConfig()? What is the 
>> preferred way of getting access to the configuration system? From the 
>> api docs this isn't clear to me...
>
> KSharedConfig.openConfig() crashes here too. Actually it complains about  
> a "pure virtual method" being called. I don't know where or which  
> exactly. KSharedConfig looks like a way of sharing config objects around  
> in a C++ program and having it cleaned up in a timely way. It doesn't  
> look relevant to Python as we already have better automatic memory  
> management.
>
> I always use KGlobal.config() and I'm fairly sure that is the right way  
> to go. If that stops working, then get back to me.

Its the completely wrong way if you want to open an arbitrary ini-style
file. This includes .desktop files as well as project files for some apps
(for example kdevelop uses kconfig-formatted files for both its project
info and project templates). 

Anyway, the right replacement to use instead of KSharedConfig::openConfig
is the KConfig constructor taking a file and open-flags.

Andreas

-- 
You will outgrow your usefulness.


More information about the PyQt mailing list