-
Notifications
You must be signed in to change notification settings - Fork 0
FSigHandle
RAII ownership of listener registrations. Destroying it unregisters everything registered through it.
Declared in Plugins/GMP/Source/GMP/GMP/GMPSignals.inl:89
// auto disconnect signals
class FSigHandle : public FSigCollection
{
public:
~FSigHandle() { DisconnectAll(); }
};Aliased as FGMPSignalsHandle in GMP/Shared/GMPCore.h:45.
A listener outliving its owner is a dangling call. For UObject owners GMP can check weak-pointer
staleness, but a plain C++ class has nothing to check — so it needs an owner object whose destructor
does the unregistering. That object is FSigHandle.
class FMyThing // not a UObject
{
GMP::FSigHandle Handle;
public:
FMyThing()
{
FGMPHelper::ListenMessage(MSGKEY("Common.Action"), &Handle,
[this](Type1& P1){ /* ... */ });
}
// ~FMyThing destroys Handle, which disconnects the listener
};GMPSignalsInc.h:28 declares a GMPSignalHandle member for classes that want this by convention rather
than by hand.

-
Disconnects all, not one. It is a collection (
FSigCollection); every registration made against it goes away together. - Order is not guaranteed across registrations, and should not be relied on.
- Destroying the handle is the only thing that has to happen. There is no explicit teardown call to forget.
- A handle is not copyable in a meaningful sense — it owns registrations, so treat it as a member, not a value to pass around.
- The owner is a
UObject— pass the object itself; staleness is checked on dispatch. - The owner is shared-pointer managed —
CreateSPLambdacovers it. - You want to unregister one specific listener rather than all of them — keep the FGMPKey returned by the listen call and unlisten with that.
Registering with this from a non-UObject class and expecting it to be safe. It is not; there is nothing
for GMP to check. Either hold an FSigHandle or manage the FGMPKey yourself.
GMP · Reference wiki — one page per named thing. Guided introduction: project site · 中文站点 · measured dispatch stack Source: repository · README · README 中文
Pages here are generated from wiki/ in the main repository — edit there, not on the wiki.
Concepts
- Why a string key
- Dispatch layers
- Parameter compatibility
- Signature inference
- Key baking
- Transparent rewrite
- Jump tracing
Sending and listening
- NotifyMessage family
- ListenMessage family
- StoreObjectMessage
- MSGKEY
- FSigSource
- FSigHandle
- FGMPKey
- FGMPResponder
Dispatch internals
Reflection and data
Editor
Build