[Qt-interest] Core dump with QLocalSocket in another thread.

David Boosalis david.boosalis at gmail.com
Wed Apr 7 23:03:39 CEST 2010


Hi
I am looking for help trying to resolve a core dump with Qt 4.6.2 on
x86-64.  I introduced the use of a  QLocalSocket that writes in one QThread,
and is read using QLocalServer in another thread.  The writes seem to work
fine for about 2 minutes then I get a core dump with the following stack.

(gdb)
where

#0  QCoreApplication::notifyInternal (this=0x7fffffffe300, receiver=0x0,
event=0x7fffffffe030)
    at
/home/david/qt/qt-everywhere-opensource-src-4.6.2/src/corelib/kernel/qcoreapplication.cpp:691

#1  0x00007ffff5f74fb5 in QCoreApplication::sendEvent (this=<value optimized
out>)


Of course the stack is much larger but nowhere do I see line numbers from my
code.  I note that the receiver variable in #0 is 0x0 and yet the code still
tries to access it in the following:

bool QCoreApplication::notifyInternal(QObject *receiver, QEvent *event)
{
    // Make it possible for Qt Jambi and QSA to hook into events even
    // though QApplication is subclassed...
    bool result = false;
    void *cbdata[] = { receiver, event, &result };
    if (QInternal::activateCallbacks(QInternal::EventNotifyCallback,
cbdata)) {
        return result;
    }

    // Qt enforces the rule that events can only be sent to objects in
    // the current thread, so receiver->d_func()->threadData is
    // equivalent to QThreadData::current(), just without the function
    // call overhead.
    QObjectPrivate *d = receiver->d_func();
    //  *DNB Added this to 0406
    if(!d) {
      qWarning() << "Receiver::func  has null value " << __FILE__ <<
__LINE__;
      return false;
    }
    //**************** DNB ^^^^^^^^^^^^


I am in the process of adding a check for NULL (DNB comments above denote
code I am going to add), but want to know if my approach points out an
ommision of this method.  Should it check for a null value?

Has anyone seen this kind of behavior (core dump) before with QLocalSockets
in a seperate thread.  The LocalSocket is created in the QThread::run()
method.  In the class creation I originally had
"moveToThread(this)", but removed it and get the same behavior either way.

Any help apprecited
-David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100407/613d4658/attachment.html 


More information about the Qt-interest-old mailing list