On quarta-feira, 18 de setembro de 2013 23:54:17, Etienne Sandré-Chardonnal wrote: > Let me explain the problem differently: > - widget A emits a signal > - widget B has a slot which effectively deletes A (because > QScrollArea::setWidget deletes its current widget) - I connected A's signal > to B's slot (and this is meaningful in this GUI, because A has a button > that tells B to go to the parent, which replaces the A widget for viewing > current node's properties) > > Just done like that, it crashes. Because after deleting A, B's slot returns > to A's meta-object signal code. Which is bad. > > Using a QueuedConnection would solve the issue. Because execution of A's > signal would post an event for calling B's slot, then exit A's signal code, > return to event loop, and exectute B's slot. Then it's safe to delete A. > However, I do not like the stability of the program to rely on the type of > connection. That's not in the essence of modularity with signal/slots. > > Thiago, if you read me, Could you confirm the above's statements?
You're correct. Deleting the sender is almost always a bad idea. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest