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. qt connect crashing app

qt connect crashing app

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 506 Views
  • 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.
  • ZgemboZ Offline
    ZgemboZ Offline
    Zgembo
    wrote on last edited by
    #1

    Hi all,

    I am going crazy with a simple connect signal and slot. I have this function startDataMonitoring() which is called from another class (GUI class). Stockert70 is not a GUI class but is used as a simple driver for communication with serial port.

    void Stockert70::startDataMonitoring()
    {
    qDebug() << m_pSerialPort->portName();
    //connected to serial port
    connect(m_pSerialPort, &QSerialPort::readyRead, this, &Stockert70::handleReadyRead);
    }

    When I call this function on a button click I get this error:
    "COM6" <--- this is a serial port name read from m_pSerialPort object so it is valid.
    Exception thrown at 0x00000000604E2D02 (Qt5Cored.dll) in QStockertSerialPort.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.

    m_pSerialPort is initialized in another function that is called before this startDataMonitoring() function.

    void Stockert70::setSerialPortParameters(QString portName)
    {
    qDebug() << "Set serial port parameters!";
    m_pSerialPort = new QSerialPort();
    m_pSerialPort->setPortName(portName);
    m_pSerialPort->setBaudRate(QSerialPort::Baud9600);
    m_pSerialPort->setDataBits(QSerialPort::Data8);
    m_pSerialPort->setParity(QSerialPort::NoParity);
    m_pSerialPort->setStopBits(QSerialPort::OneStop);
    m_pSerialPort->setFlowControl(QSerialPort::NoFlowControl);
    }

    Any suggestions?

    1 Reply Last reply
    0
    • Kent-DorfmanK Offline
      Kent-DorfmanK Offline
      Kent-Dorfman
      wrote on last edited by Kent-Dorfman
      #2

      Well, you've got a null pointer somewhere. That much is ovbious. OK..."poorly initialize pointer" would be the better description.

      And don't do serial comms without flow control. That makes me grind my teeth.

      ZgemboZ 1 Reply Last reply
      0
      • Kent-DorfmanK Kent-Dorfman

        Well, you've got a null pointer somewhere. That much is ovbious. OK..."poorly initialize pointer" would be the better description.

        And don't do serial comms without flow control. That makes me grind my teeth.

        ZgemboZ Offline
        ZgemboZ Offline
        Zgembo
        wrote on last edited by
        #3

        @kent-dorfman Yeh but where? m_pSerialPort is not null

        ZgemboZ 1 Reply Last reply
        0
        • ZgemboZ Zgembo

          @kent-dorfman Yeh but where? m_pSerialPort is not null

          ZgemboZ Offline
          ZgemboZ Offline
          Zgembo
          wrote on last edited by
          #4

          @zgembo Found out. Stupid mistake. I have creted in .h file a pointe Stockert70 *stockert; and in .cpp I copy and pasted
          Stockert70 *stockert = new Stockert70(this);

          Lost a day on this.

          1 Reply Last reply
          3

          • Login

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