Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Stack smashing problem in readyRead() signal
Forum Updated to NodeBB v4.3 + New Features

Stack smashing problem in readyRead() signal

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 2.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    soroush
    wrote on last edited by
    #1

    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!' "
    // ...
    }
    @

    1 Reply Last reply
    0
    • M Offline
      M Offline
      miroslav
      wrote on last edited by
      #2

      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.

      Mirko Boehm | mirko@kde.org | KDE e.V.
      FSFE Fellow
      Qt Certified Specialist

      1 Reply Last reply
      0
      • S Offline
        S Offline
        soroush
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tobias.hunger
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0
          • S Offline
            S Offline
            soroush
            wrote on last edited by
            #5

            [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)!

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved