Solved Disconnect slot when deleting object
-
Do I have to disconnect the slot of an object, when I delete the object with deleteLater() or will the slot be deleted when I call deleteLater() on the object?
-
@Infinity said in Disconnect slot when deleting object:
will the slot be deleted
a slot is a function - this can not be deleted. What will be deleted is the connection between the signal and the slot.
And yes this connection is deleted - anything else would be... hard to maintain. -
@Infinity said in Disconnect slot when deleting object:
will the slot be deleted
a slot is a function - this can not be deleted. What will be deleted is the connection between the signal and the slot.
And yes this connection is deleted - anything else would be... hard to maintain. -
No u need not disconnect the connect statement. No, the Slot will not be deleted when you delete the object since slot is nothing but a member function of the class. Just the object will be deleted and after the object is deleted the connection will be automatically disconnected.
-
@Infinity may be you thinking in wrong way because slot is just a function and there is option like disconnect is only for connect statement ,so if you want to stop signal and slot communication then you may use this disconnect
-
@Infinity this will help you . Disconnect . read carefully.
-
Thank you very much for your answers. Obviously my question was wrong. Of course I meant whether the slot will be disconnected and not deleted. Anyway I figured out from your answers that the slot will be disconnected when the Object is deleted with deleteLater(). Am I correct?
-
@Infinity said in Disconnect slot when deleting object:
when the Object is deleted with deleteLater(). Am I correct?
I already answered this in the first post...
And yes this connection is deleted
-
@Christian-Ehrlicher Yes. Thank you very much. Your answer was very helpful.