SIGSEGV Segmentation Fault after connectToHostEncrypted
-
Hello, help me! I have QT 5.91 Community and after compile/run is application terminated with error SIGSEGV Segmentation Fault after socket->connectToHostEncrypted(host,port). Linux 64bit GCC 7.1.1 . I mean application is OK. OPENSSL is last version 1.0.2. Here is Backtrace output:
[0_1502507131850_bt1.txt](Uploading 100%)
Here is Disassembler output:
[0_1502507221478_DisAssembler.asm](Uploading 100%)
CPP:
[0_1502507242750_qtsslreceiver.cpp](Uploading 100%)
HEADER:
[0_1502507264725_qtsslreceiver.h](Uploading 100%)
-
Hi
One thing that i noted.
you define
QSslSocket *msocket;
but do not set to nullptr
and then use it latervoid QtSslReceiver::OnConnect(const QString &hostname,unsigned short port) { if (!msocket) <<<< Might not be null, might be random value here { msocket = new QSslSocket(this); xx } msocket->ignoreSslErrors(); <<< Might crash hereTo check if that
just try
msocket=nullptr; ( or set it to null in .h)
OnConnect("kapitanf.ddns.net", 5000);Thats stops it crashing here when i run it.
-
Hi and welcome to devnet,
That doesn't help much, you seem to be trying to show the stack trace of a release build of your application. You should rather start it in debug mode with a debug build.
-
Hi, SGaist, thank you for Reply. And here is the problem. I am trying debugging and it behaves like Release. QtCreator say in Debug mode:
Starting /home/freefilip/build-QtSslReceiver-Unnamed-Debug/QtSslReceiver...
The program has unexpectedly finished.
/home/freefilip/build-QtSslReceiver-Unnamed-Debug/QtSslReceiver crashed.I dont know, where is my fail? Debug will detect nothing. Compiler compile my application without problems, BUT after running application program generate error SIGSEGV.
-
Can you show your .pro file ?
Which Linux distribution are you using ?
Which version of GDB ? -
To localize the problem it could be a good idea to use the qt-libraries with symbols (debug version of qt-build)
-
main.cpp : https://pastebin.com/cPjTKygq
qtsslreceiver.cpp : https://pastebin.com/dEtj6E7n
qtsslreceiver.h : https://pastebin.com/TzcktAay
qtsslreceiver.pro : https://pastebin.com/KujH0e8k
qtsslreceiver.ui : https://pastebin.com/kLxVkFxEI dont know, how enable Drag and Drop for this forum.
-
Hi
One thing that i noted.
you define
QSslSocket *msocket;
but do not set to nullptr
and then use it latervoid QtSslReceiver::OnConnect(const QString &hostname,unsigned short port) { if (!msocket) <<<< Might not be null, might be random value here { msocket = new QSslSocket(this); xx } msocket->ignoreSslErrors(); <<< Might crash hereTo check if that
just try
msocket=nullptr; ( or set it to null in .h)
OnConnect("kapitanf.ddns.net", 5000);Thats stops it crashing here when i run it.
-
Oh super . it was only that. the revenge of the uninitialized variable. ;)