Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, November 2007
QSslSocket emits readyRead while in write()


Message 1 in thread

I have a problem with QSslSocket. If data arrives at a socket during a 
write() call, the socket will emit readyRead(). This causes reentrancy 
problems for me.

For example, what if the message received is "I want to disconnect"? 
Then the socket is closed and deleted by my program, meaning by the time 
the write() call returns it's dealing with a deleted socket.

I may be mistaken, but I believe that QTcpSocket "held on to" the 
readyRead() until it was back in the main event loop. Does anyone know 
of a way to make QSslSocket do just that?

--
 [ signature omitted ] 

Message 2 in thread

Em Friday 02 November 2007 13:19:48 Thorvald Natvig escreveu:
> I have a problem with QSslSocket. If data arrives at a socket during a
> write() call, the socket will emit readyRead(). This causes reentrancy
> problems for me.
>
> For example, what if the message received is "I want to disconnect"?
> Then the socket is closed and deleted by my program, meaning by the time
> the write() call returns it's dealing with a deleted socket.
>
> I may be mistaken, but I believe that QTcpSocket "held on to" the
> readyRead() until it was back in the main event loop. Does anyone know
> of a way to make QSslSocket do just that?

Can you test Qt 4.4? I've changed the behaviour of QSslSocket and it should no 
longer cause you the reentrancy problems.

-- 
 [ signature omitted ] 

Attachment: signature.asc
Description: This is a digitally signed message part.