[Solved] Basic and Dumb Question but I couldn't find an answer
-
Brief Question: Does the deletelater() method also disconnects signal and slots related to the destroyed item?
More detailed explanation:
I'm developing a small program that would work both as server and as client so based on the use I create and connect to the main window a QObject-based item that works as the server or the client. Since a user may potnetially switch to server to client and vice versa many times during a session, and when he does I schedule the client or server that he was using for deletion, I'd like to know if the deletelater() method also disconnects signal and slots related to the destroyed item or I should do it manually. -
You don't need to worry about that :) And if you do, you can easily disconnect manually all the connections with just a single line of code (see QObject documentation).
-
Well, actually, it is a good question.
Normally, when an object is destroyed, all signal-slot connections it is involved in are disconnected. However, this happens on the actual desctruction of the object, so not when you call deleteLater(). So yes, even after calling deleteLater(), the object may still emit signals or respond to signals.