Solved 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 here
To 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 ? -
Debugger is:
GNU gdb (GDB) Fedora 8.0-20.fc26OS:
Fedora 26 (last update kernel 4.11.11-300)Here is .pro file:
[0_1502664502899_QtSslReceiver.pro](Uploading 100%) -
Some other ideas?
-
Hi
All we see it
[0_1502664502899_QtSslReceiver.pro](Uploading 100%)Do you see real images?
-
No ,i see only [0_1502664502899_QtSslReceiver.pro](Uploading 100%), i not see real images.
-
To localize the problem it could be a good idea to use the qt-libraries with symbols (debug version of qt-build)
-
Hi Karl, thanks for Reply, where i find the debug version of qt-build?
-
All needed QT files installed on my OS. I know, Debug not work only on my application! Is it SIGNAL from kernel OS, which raise exception SIGSEGV, or is it application compile/dynamic linker error. Is problem in QMAKE, GCC, GDB or CMAKE?
-
Any ideas?
-
@KapitanF
since none of the images or code is shown, it hard to guess at anything. :) -
Ok i understand. I have not permissions to Drag and Drop! Ho i enable it?
-
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 here
To 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 mrjj, thank you for Solution. Now application work right. THANK you very much.
-
Oh super . it was only that. the revenge of the uninitialized variable. ;)