How to ensure handling of signals before executing next statement?
-
I have a sender that emits a signal toDelete(ObjectOfMyClass*). The next statement after this signal will be deletion of the ObjectOfMyClass. How do I ensure that any receivers of this signal execute their slot code before the deletion of the ObjectOfMyClass? Point is that these receivers need to access ObjectOfMyClass before it is actually deleted?
-
Hi
If you use DirectConnection
connect( A, SIGNAL(somethingChanged()), B, SLOT(handleChange()), Qt::DirectConnection );
Then its much like a function call but i never tested if you can rely on it :) -
Well, a better/other design where it is not need to say goodbye to an instance would be prefered.
So sounds like you found the truly right solution :) -
Hi,
Until you start having threads in the mix.
The design looks a bit dubious, you should rather have some sort of synchronisation mechanism.
What does the connected objects have to do with your ObjectOfMyClass instance when it's about to get destroyed ?