It's necessary to add a QCoreApplication to kdeinit4

潘卫平 panweiping3 at gmail.com
Tue Oct 14 04:52:13 BST 2008


Hi all,
I made two experiments:
the first program is:
#include <QCoreApplication>
#include <QFile>
#include <stdio.h>
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
printf("%s\n", QFile::encodeName(QString::fromUtf8("*/home/*潘")).data());
return 0;
}
the output is:
*/home/*潘

the second program is:
#include <QCoreApplication>
#include <QFile>
#include <stdio.h>
int main(int argc, char *argv[])
{
//QCoreApplication app(argc, argv);
printf("%s\n", QFile::encodeName(QString::fromUtf8("*/home/*潘")).data());
return 0;
}
the output is:
*/home/*

QFile::encodeName got wrong file name without a QCoreApplication object !
(my locale is zh_CN.UTF-8)

From the error messages:
"
trying to create local folder */home/*.kde: Permission denied
trying to create local folder */home/*.kde: Permission denied
Link points to "/tmp/ksocket-潘"
trying to create local folder */home/*.kde: Permission denied
kdeinit4: Aborting. bind() failed: : No such file or directory
Could not bind to socket
'*/home/*.kde/socket-localhost.localdomain/kdeinit4__0'
"
I find that maybe something is wrong when binding a socket.

kdelibs/kinit/kinit.cpp
main() function calls kdeinit_library_path() function.
1808 kdeinit_library_path();

and in kdeinit_library_path() function,
1562 QByteArray socketName =
QFile::encodeName(KStandardDirs::locateLocal("socket",
QString("kdeinit4_%1").a rg(QLatin1String(display)), *s_instance));

I think that's the reason why kdeinit4 binds the socket wrongly,
and we should add a QCoreAoolication to make QFile, QDir and other QT
class work in kdeinit4.

Best regards!

pwp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20081014/09ceb034/attachment.htm>
-------------- next part --------------
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


More information about the kde-core-devel mailing list