PDA

View Full Version : QAbstractSocket::abort() with SIGSEGV



mtrpoland
24th February 2008, 16:00
I met quite confusing situation:
I place brand new QTcpSocket and QUdpSocket on heap in main widget constructor.

I used UDP socket (it worked fine) and then I added TCP socket. It does nothing.
And now when the method shown below is executed I receive SIGSEGV:

udpSocket->abort();
tcpSocket->abort();

gdb says:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1225090688 (LWP 6134)]
QAbstractSocket::abort (this=0x0) at qabstractsocket.h:184
184 qabstractsocket.h: No such file or directory.
in qabstractsocket.h
Current language: auto; currently c++

but when I change it to:
udpSocket->abort();
tcpSocket->disconnectFromHost();

everything goes well.

What's the matter?

wysota
24th February 2008, 17:05
Either tcpSocket or udpSocket is a null pointer (notice that "this" is null). You probably have a local variable of the same name as a member variable of the class.