Jkarneges 

Developers: Qt Signal-Safety

Tuesday, 9 March 2004
After many years of writing Qt code, most of which has been non-GUI-based, I've gained a great deal of experience with signals and slots. One tricky issue about signals is that they are generally emitted when the QObject is not in a safe state to be deleted. This can often bite the user of such an object unexpectedly, especially when performing resets or invoking QMessageBox. The simple solution is to write all QObject classes in such a way that they are deletable as the result of any signal they emit. I've written an article on Signal-safety, where I outline the problem and solution, as well as provide workarounds for safely handling misbehaving objects (those that don't follow such guidelines). Every Qt developer should read and understand this. Happy coding! Read More