[dot] Developers: Qt Signal-Safety
Dot Stories
stories at kdenews.org
Tue Mar 9 05:23:11 CET 2004
URL: http://dot.kde.org/1078803652/
From: Justin Karneges <justin-qt at affinix.com>
Dept: code-should-not-explode
Date: Tuesday09/Mar/2004, @04:40
Developers: Qt Signal-Safety
============================
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 [http://affinix.com/~justin/signalsafety.html], 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!
More information about the dot-stories
mailing list