<html>
<head>
<style type="text/css">
<!--
body { line-height: normal; margin-right: 4px; margin-bottom: 1px; margin-top: 4px; margin-left: 4px; font-variant: normal }
-->
</style>
</head>
<body style="margin-right: 4px; margin-bottom: 1px; margin-top: 4px; margin-left: 4px">
<DIV>
Hi George,
</DIV>
<DIV>
</DIV>
<DIV>
Thanks for the answer.
</DIV>
<DIV>
I am pasting here the stack trace for the crash when KApplication is not used.
</DIV>
<DIV>
Also please find the snippet of my code sequence below..
</DIV>
<DIV>
So is there no way for me to access kwallet secrets without linking to Qt..?
</DIV>
<DIV>
</DIV>
<DIV>
Thanks,
</DIV>
<DIV>
Rajaram.
</DIV>
<DIV>
</DIV>
<DIV>
<u><b>Crash trace :</b></u>
</DIV>
<DIV>
</DIV>
<DIV>
Program received signal SIGSEGV, Segmentation fault.
</DIV>
<DIV>
[Switching to Thread 1088626368 (LWP 18829)]
</DIV>
<DIV>
0x40a4b062 in KInstance::dirs () from /opt/kde3/lib/libkdecore.so.4
</DIV>
<DIV>
(gdb)
</DIV>
<DIV>
(gdb) where
</DIV>
<DIV>
#0 0x40a4b062 in KInstance::dirs () from /opt/kde3/lib/libkdecore.so.4
</DIV>
<DIV>
#1 0x40a4b0f2 in KGlobal::dirs () from /opt/kde3/lib/libkdecore.so.4
</DIV>
<DIV>
#2 0x40a75fc4 in KConfigBackEnd::changeFileName () from /opt/kde3/lib/libkdecore.so.4
</DIV>
<DIV>
#3 0x40a76287 in KConfigBackEnd::KConfigBackEnd () from /opt/kde3/lib/libkdecore.so.4
</DIV>
<DIV>
#4 0x40a77f8b in KConfig::KConfig () from /opt/kde3/lib/libkdecore.so.4
</DIV>
<DIV>
#5 0x4003cc54 in KWallet::Wallet::NetworkWallet () from /opt/kde3/lib/libkwalletclient.so.1
</DIV>
<DIV>
#6 0x0804a099 in DCOPDemoWidget::setKWalletSecret (this=0x8050968) at mytest.cpp:51
</DIV>
<DIV>
#7 0x0804a2a5 in main (argc=1, argv=0xbfffe894) at mytest.cpp:169
</DIV>
<DIV>
(gdb) quit
</DIV>
<DIV>
</DIV>
<DIV>
</DIV>
<DIV>
<u><b>Code snippet : </b></u>
</DIV>
<DIV>
</DIV>
<DIV>
void DCOPDemoWidget::setKWalletSecret()
</DIV>
<DIV>
{
</DIV>
<DIV>
</DIV>
<DIV>
Wallet *s_wallet;
</DIV>
<DIV>
...................
</DIV>
<DIV>
...................
</DIV>
<DIV>
s_wallet = Wallet::openWallet(Wallet::NetworkWallet(),0,Wallet::Synchronous);
</DIV>
<DIV>
connect(s_wallet, SIGNAL(walletClosed()),this, SLOT(dump()));
</DIV>
<DIV>
kp = s_wallet->setFolder("Passwords");
</DIV>
<DIV>
.....................
</DIV>
<DIV>
}
</DIV>
<DIV>
</DIV>
<DIV>
int main( int argc, char **argv )
</DIV>
<DIV>
{
</DIV>
<DIV>
</DIV>
<DIV>
KCmdLineArgs::init( argc, argv, "dcopifacedemo", "", "" );
</DIV>
<DIV>
</DIV>
<DIV>
<b>// If I just remove this comment, it is working. </b>
</DIV>
<DIV>
// KApplication app;
</DIV>
<DIV>
DCOPDemoWidget *win = new DCOPDemoWidget();
</DIV>
<DIV>
win->setKWalletSecret();
</DIV>
<DIV>
}
</DIV>
<DIV>
</DIV>
<DIV>
<br>
<br>
>>>staikos@kde.org 03/24/05 3:29 pm >>><br>On Thursday 24 March 2005 06:17, Suryanarayanan Rajaram wrote:<br>>I am trying to write an application which reads and writes secrets in<br>>kwallet.<br>><br>>From the details I got through the web , I understand that we can do<br>>this by either of the following ways.<br>><br>>1. Talk to the client APIs provided by the Kwallet::Wallet class<br>>2. Use the DCOP interface provided by the kwallet service.<br><br> Correct. In fact, they are both the same thing too. The KWallet client<br>API uses DCOP.<br><br>>For using method 2, my application needs to register as DCOP client and<br>>communicate to the kwallet service via DCOP.<br>>I tried using seemingly easier method 1 . But I see that my application<br>>needs to be a KDE application to talk to Kwallet::Wallet APIs. i.e I had<br>>to use QObject related stuff and KApplication in my code. Otherwise I<br>>get some segmentation fault while trying to open a wallet.<br>><br>>I would like to know if there is any way to write a simple application<br>>which doesnt need KApplication or QObject related things ( non-KDE ) and<br>>still can access kwallets.<br>>It would be helpful if anybody could provide me the details for this and<br>>any related links.<br><br> The fact remains that KWallet needs DCOP for synchronization purposes. <br>DCOP should still work without a KApplication, but it definitely requires<br>linking to Qt. If you can handle that, we can work to find out what the<br>problems are with not having a KApplication. I suspect it has to do with the<br>KConfig usage, and we can probably find workarounds to that for you.<br><br> Do you have a stack trace for the crashes when you link Qt but don't use a<br>KApplication?<br><br>--<br>George Staikos<br>KDE Developerhttp://www.kde.org/<br>Staikos Computing Services Inc.http://www.staikos.net/<br>
</DIV>
</body>
</html>