PDA

View Full Version : Using QtSerialPort results in "APPCRASH"



M4chin3
3rd June 2013, 13:02
Hi,

i'm trying to use the QtSerialPort Libary (http://qt-project.org/wiki/QtSerialPort). The install process worked fine (with Perl installed).
The problem is, as soon as i start my test program (debug or release mode) it crashes with this error:

Problemsignatur:
Problemereignisname: APPCRASH
Anwendungsname: Test.exe
Anwendungsversion: 0.0.0.0
Anwendungszeitstempel: 51a3623c
Fehlermodulname: Qt5Cored.dll
Fehlermodulversion: 5.0.2.0
Fehlermodulzeitstempel: 516367ae
Ausnahmecode: c0000005
Ausnahmeoffset: 00021f3b
Betriebsystemversion: 6.1.7601.2.1.0.256.48
Gebietsschema-ID: 1031
Zusatzinformation 1: 0a9e
Zusatzinformation 2: 0a9e372d3b4ad19135b953a78882e789
Zusatzinformation 3: 0a9e
Zusatzinformation 4: 0a9e372d3b4ad19135b953a78882e789


.cpp file:


#include <QtCore/QCoreApplication>
#include <QtCore/QDebug>

#include <QtSerialPort/QSerialPort>
#include <QtSerialPort/QSerialPortInfo>

QT_USE_NAMESPACE

int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);

qDebug() << "Begin";

// Example use QSerialPortInfo
foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) {
qDebug() << "Name : " << info.portName();
qDebug() << "Description : " << info.description();
qDebug() << "Manufacturer: " << info.manufacturer();

// Example use QSerialPort
QSerialPort serial;
serial.setPort(info);
if (serial.open(QIODevice::ReadWrite))
serial.close();
}

qDebug() << "End";
return a.exec();
}


.pro file:


#-------------------------------------------------
#
# Project created by QtCreator 2013-05-10T15:50:24
#
#-------------------------------------------------

QT += core

QT -= gui

QT += serialport

TARGET = Test
CONFIG += console
CONFIG -= app_bundle

TEMPLATE = app


SOURCES += main.cpp



My setup is:
Windows 7 Prof. 64 bit
Qt 5.0.2 32 bit
QtSerialPort Stable (f301591)


Any ideas?

pkj
3rd June 2013, 13:17
Your exe is not able to find the correct dll for QSerialPort. It is able to link properly but absence of dll causes it to crash. Check the dll with right name (QSerialPort0.dll / QSerialPort.dll, check the wiki...) is available in the path of executable.

M4chin3
3rd June 2013, 14:23
I tried your suggestion and copied Qt5SerialPort.dll and Qt5SerialPortd.dll into the *.exe folder but it didn't work.
I still get the same error. :(

Added after 15 minutes:

I tracked the error with debug mode and there i get a "SIGSEGV" "Segmentation fault" error within the file: "qserialportinfo_win.cpp" in line 132 (QByteArray data(datasize, 0)) while creating the QByteArray. (datasize = 10 btw)
In my opinion the error seems to be somewhere in the QByteArray constructor, but i doubt that...

Any further ideas?

ChrisW67
4th June 2013, 02:56
Run your program in your debugger. When it crashes inspect the stack backtrace. Starting at the top work down until you find which line of your code is triggering the problem. Is it listing the ports, constructing the QSerialPort, or trying to open/close it?

M4chin3
4th June 2013, 08:16
I tracked the error with debug mode and there i get a "SIGSEGV" "Segmentation fault" error within the file: "qserialportinfo_win.cpp" in line 132 (QByteArray data(datasize, 0)) while creating the QByteArray. (datasize = 10 btw)
In my opinion the error seems to be somewhere in the QByteArray constructor, but i doubt that...

Any further ideas?

M4chin3
5th June 2013, 11:49
Is anyone able to reproduce this error?

I also tried the same on a Windows XP 32 bit machine, and got the same error.

M4chin3
17th June 2013, 14:48
I also tried it with the newest release version of QtSerialPort. But i still get this error on both machines (Win7 64bit and WinXP 32bit)