This forum has been archived. All content is frozen. Please use KDE Discuss instead.

[SOLVED] KIO::get Segmentation Fault

Tags: None
(comma "," separated)
Lumos
Registered Member
Posts
2
Karma
0
OS
Hi,

I'm getting segmentation faults when running the following unit test. When I comment either one of the two lines in testLogin, the program runs. So it only happens when the job is actually executed, I think.

Any ideas?

Lumos
(System: KDE 4.2.2 on Ubuntu Jaunty x86.)

Code: Select all
#include
#include
#include

#include

class GDataClientTest: public QObject
{
Q_OBJECT

private slots:
    void testLogin();
};

void GDataClientTest::testLogin()
{
    KIO::TransferJob *job = KIO::get(KUrl("http://www.kde.org"));
    QTest::qWait(1000);
}

QTEST_MAIN(GDataClientTest)
#include "gdataclienttest.moc"


Output:
Code: Select all
Starting program: /home/peter/projects/GData/build/gdataclienttest
[Thread debugging using libthread_db enabled]
[New Thread 0xb5e0e9f0 (LWP 9350)]
********* Start testing of GDataClientTest *********
Config: Using QTest library 4.5.0, Qt 4.5.0
PASS   : GDataClientTest::initTestCase()
QDEBUG : GDataClientTest::testLogin() (9350)/ KSharedUiServerProxy::KSharedUiServerProxy: kuiserver registered
QDEBUG : GDataClientTest::testLogin() (9350)/ KSycocaPrivate::openDatabase: Trying to open ksycoca from  "/var/tmp/kdecache-peter/ksycoca4"
QDEBUG : GDataClientTest::testLogin() (9350)/ KIO::ConnectionServer::listenForRemote: Listening on  "local:/tmp/ksocket-peter/gdataclienttestMT9350.slave-socket"
QDEBUG : GDataClientTest::testLogin() (9350)/ KIO::Slave::createSlave: createSlave "http" for KUrl("http://www.kde.org")
QDEBUG : GDataClientTest::testLogin() (9350)/ KIO::ConnectionServer::listenForRemote: Listening on  "local:/tmp/ksocket-peter/gdataclienttesthX9350.slave-socket"

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb5e0e9f0 (LWP 9350)]
0xb7e40a2d in KLocale::languageList () from /usr/lib/libkdecore.so.5


Stacktrace:
Code: Select all
#0  0xb7e40a2d in KLocale::languageList () from /usr/lib/libkdecore.so.5
#1  0xb67b8e5b in KProtocolManager::acceptLanguagesHeader () from /usr/lib/libkio.so.5
#2  0xb67fa740 in KIO::SessionData::reset () from /usr/lib/libkio.so.5
#3  0xb67fad78 in KIO::SessionData::configDataFor () from /usr/lib/libkio.so.5
#4  0xb67f56b6 in ?? () from /usr/lib/libkio.so.5
#5  0xb67f8b59 in ?? () from /usr/lib/libkio.so.5
#6  0xb67f8ca0 in ?? () from /usr/lib/libkio.so.5
#7  0xb67f8f06 in KIO::Scheduler::qt_metacall () from /usr/lib/libkio.so.5
#8  0xb7b2fca8 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#9  0xb7b30932 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#10 0xb7b6b717 in QTimer::timeout () from /usr/lib/libQtCore.so.4
#11 0xb7b356fe in QTimer::timerEvent () from /usr/lib/libQtCore.so.4
#12 0xb7b2a15f in QObject::event () from /usr/lib/libQtCore.so.4
#13 0xb7b18db3 in QCoreApplicationPrivate::notify_helper () from /usr/lib/libQtCore.so.4
#14 0xb7b19473 in QCoreApplication::notify () from /usr/lib/libQtCore.so.4
#15 0xb7b19a3b in QCoreApplication::notifyInternal () from /usr/lib/libQtCore.so.4
#16 0xb7b48d71 in ?? () from /usr/lib/libQtCore.so.4
#17 0xb7b454e0 in ?? () from /usr/lib/libQtCore.so.4
#18 0xb63a2a58 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#19 0xb63a5fbb in ?? () from /usr/lib/libglib-2.0.so.0
#20 0xb63a6138 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#21 0xb7b45438 in QEventDispatcherGlib::processEvents () from /usr/lib/libQtCore.so.4
#22 0xb7b1aa82 in QCoreApplication::processEvents () from /usr/lib/libQtCore.so.4
#23 0x0804a4a7 in qWait (ms=1000) at /usr/include/qt4/QtTest/qtestsystem.h:64
#24 0x0804a52a in GDataClientTest::testLogin (this=0xbfc3375c) at /home/peter/projects/GData/gdataclienttest.cpp:18
#25 0x0804a5a3 in GDataClientTest::qt_metacall (this=0xbfc3375c, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0xbfc32c68) at /home/peter/projects/GData/build/gdataclienttest.moc:65
#26 0xb7b227a9 in QMetaMethod::invoke () from /usr/lib/libQtCore.so.4
#27 0xb7b22f2f in QMetaObject::invokeMethod () from /usr/lib/libQtCore.so.4
#28 0xb7944477 in ?? () from /usr/lib/libQtTest.so.4
#29 0xb79452dc in ?? () from /usr/lib/libQtTest.so.4
#30 0xb7945673 in QTest::qExec () from /usr/lib/libQtTest.so.4
#31 0x0804a3c7 in main (argc=1, argv=0xbfc33814) at /home/peter/projects/GData/gdataclienttest.cpp:21
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
You need a valid KApplication instance in order to use most KDE library functions, since translation is required.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
Lumos
Registered Member
Posts
2
Karma
0
OS
Using QTEST_KDEMAIN_CORE(GDataClientTest) instead of QTEST_MAIN(GDataClientTest) fixed it indeed.

Thanks!

Lumos


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell