X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fnetradiant.git;a=blobdiff_plain;f=contrib%2Fbobtoolz%2FDTreePlanter.h;h=7fceba3aa665d19c1f71e2cfc6c896ea187ef6ee;hp=61bc1e8950e50130b2a4a79250aa1954ce0e21d7;hb=06eb8cc3a4046af318da7f7b9fae1c04be8c0380;hpb=d617f066bc8f3b5a852859e7d4be3a29bca69b89 diff --git a/contrib/bobtoolz/DTreePlanter.h b/contrib/bobtoolz/DTreePlanter.h index 61bc1e89..7fceba3a 100644 --- a/contrib/bobtoolz/DTreePlanter.h +++ b/contrib/bobtoolz/DTreePlanter.h @@ -39,9 +39,16 @@ typedef struct treeModel_s { class DTreePlanter { MouseEventHandlerId m_mouseDown; + SignalHandlerId m_destroyed; public: SignalHandlerResult mouseDown(const WindowVector& position, ButtonIdentifier button, ModifierFlags modifiers); typedef Member3 MouseDownCaller; + void destroyed() + { + m_mouseDown = MouseEventHandlerId(); + m_destroyed = SignalHandlerId(); + } + typedef Member DestroyedCaller; DTreePlanter() { m_numModels = 0; @@ -83,11 +90,19 @@ public: } m_mouseDown = GlobalRadiant().XYWindowMouseDown_connect(makeSignalHandler3(MouseDownCaller(), *this)); + m_destroyed = GlobalRadiant().XYWindowDestroyed_connect(makeSignalHandler(DestroyedCaller(), *this)); } virtual ~DTreePlanter() { - GlobalRadiant().XYWindowMouseDown_disconnect(m_mouseDown); + if(!m_mouseDown.isNull()) + { + GlobalRadiant().XYWindowMouseDown_disconnect(m_mouseDown); + } + if(!m_destroyed.isNull()) + { + GlobalRadiant().XYWindowDestroyed_disconnect(m_destroyed); + } } #define MT(t) string_equal_nocase( pToken, t )