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
Forum Updated to NodeBB v4.3 + New Features

qt connect crashing app

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 526 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.
  • Z Offline
    Z Offline
    Zgembo
    wrote on 30 Jul 2019, 19:45 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
    • K Offline
      K Offline
      Kent-Dorfman
      wrote on 30 Jul 2019, 20:02 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.

      Z 1 Reply Last reply 30 Jul 2019, 20:14
      0
      • K Kent-Dorfman
        30 Jul 2019, 20:02

        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.

        Z Offline
        Z Offline
        Zgembo
        wrote on 30 Jul 2019, 20:14 last edited by
        #3

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

        Z 1 Reply Last reply 30 Jul 2019, 20:19
        0
        • Z Zgembo
          30 Jul 2019, 20:14

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

          Z Offline
          Z Offline
          Zgembo
          wrote on 30 Jul 2019, 20:19 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

          1/4

          30 Jul 2019, 19:45

          • Login

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