mirror of
https://github.com/storytold/UE4-OSC.git
synced 2026-10-09 00:09:43 +00:00
crashfix: using OSC as input key
This commit is contained in:
@@ -161,7 +161,7 @@ void UOscSettings::ClearKeyInputs(UOscDispatcher & dispatcher)
|
|||||||
{
|
{
|
||||||
// Unregister here, not in the OscReceiverInputKey destructor
|
// Unregister here, not in the OscReceiverInputKey destructor
|
||||||
// because it would crash at the application exit.
|
// because it would crash at the application exit.
|
||||||
dispatcher.UnregisterReceiver(&receiver);
|
dispatcher.UnregisterReceiver(receiver.get());
|
||||||
}
|
}
|
||||||
_keyReceivers.Reset(0);
|
_keyReceivers.Reset(0);
|
||||||
}
|
}
|
||||||
@@ -171,7 +171,8 @@ void UOscSettings::UpdateKeyInputs(UOscDispatcher & dispatcher)
|
|||||||
ClearKeyInputs(dispatcher);
|
ClearKeyInputs(dispatcher);
|
||||||
for(const auto & address : Inputs)
|
for(const auto & address : Inputs)
|
||||||
{
|
{
|
||||||
_keyReceivers.Emplace(address);
|
auto receiver = std::make_unique<OscReceiverInputKey>(address);
|
||||||
dispatcher.RegisterReceiver(&_keyReceivers.Last());
|
dispatcher.RegisterReceiver(receiver.get());
|
||||||
|
_keyReceivers.Add(std::move(receiver));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,5 +73,5 @@ private:
|
|||||||
TSharedRef<FSocket> _sendSocket;
|
TSharedRef<FSocket> _sendSocket;
|
||||||
TArray<TSharedRef<FInternetAddr>> _sendAddresses;
|
TArray<TSharedRef<FInternetAddr>> _sendAddresses;
|
||||||
TMap<FString, int32> _sendAddressesIndex;
|
TMap<FString, int32> _sendAddressesIndex;
|
||||||
TArray<OscReceiverInputKey> _keyReceivers;
|
TArray<std::unique_ptr<OscReceiverInputKey>> _keyReceivers;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
/// Base class to receive OSC messages.
|
/// Base class to receive OSC messages.
|
||||||
struct IOscReceiverInterface
|
struct IOscReceiverInterface
|
||||||
{
|
{
|
||||||
|
virtual ~IOscReceiverInterface() {}
|
||||||
virtual const FString & GetAddressFilter() const = 0;
|
virtual const FString & GetAddressFilter() const = 0;
|
||||||
virtual void SendEvent(const FName & Address, const TArray<FOscDataElemStruct> & Data, const FString & SenderIp) = 0;
|
virtual void SendEvent(const FName & Address, const TArray<FOscDataElemStruct> & Data, const FString & SenderIp) = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user