Stack smashing problem in readyRead() signal



  • Hi

    I've write a class derived from QUdpSocket and connected its readyRead signal to a slot of itself, say for example processData signal of X, an instance of 'Connection' class. When data is provided by UDP server program, readyRead is triggered, so processData is called. but processData sends some responds to server and server immediately sends validation data. so before first call of processData is finished, second one is called (I assume signal/slot mechanism of QUdpSocket is multi-threaded [?]) and this go on until OS detects an attack to fill the stack and kills the process...

    @
    class Connection : public QUdpSocket
    {
    //...
    public slots:
    void processData();
    //...
    }
    // Implementation:
    void Connection::processData()
    {
    //...
    writeDatagram("Hello!",QHostAddress::LocalHost,this->portNumber); // Server responds "Received 'Hello!' "
    // ...
    }
    @



  • Are you maybe processing events in your processData slot implementation? That would result in Qt going back to the event loop and potentially calling processData again. Set a breakpoint in processData(), and when it is hit the second time, walk up the stack to see what is calling it.



  • I'm not sure if I understand correctly or not...
    Call stack is like this:
    0: Connection::processData
    1: Connection::qt_metacall
    ....


  • Moderators

    qt_metacall just shows that it was triggered via a signal/slot connection. You will need to dig deeper.



  • [quote author="Tobias Hunger" date="1328605587"]qt_metacall just shows that it was triggered via a signal/slot connection. You will need to dig deeper.[/quote]

    OK ... this is call stack:
    !http://s2.picofile.com/file/7285959886/snapshot12.png(Call stack)!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.