crashfix: using OSC as input key

This commit is contained in:
monsieurgustav
2017-03-18 08:54:52 +01:00
parent 0cab55b697
commit 71686de2b7
3 changed files with 6 additions and 4 deletions
+4 -3
View File
@@ -161,7 +161,7 @@ void UOscSettings::ClearKeyInputs(UOscDispatcher & dispatcher)
{
// Unregister here, not in the OscReceiverInputKey destructor
// because it would crash at the application exit.
dispatcher.UnregisterReceiver(&receiver);
dispatcher.UnregisterReceiver(receiver.get());
}
_keyReceivers.Reset(0);
}
@@ -171,7 +171,8 @@ void UOscSettings::UpdateKeyInputs(UOscDispatcher & dispatcher)
ClearKeyInputs(dispatcher);
for(const auto & address : Inputs)
{
_keyReceivers.Emplace(address);
dispatcher.RegisterReceiver(&_keyReceivers.Last());
auto receiver = std::make_unique<OscReceiverInputKey>(address);
dispatcher.RegisterReceiver(receiver.get());
_keyReceivers.Add(std::move(receiver));
}
}
+1 -1
View File
@@ -73,5 +73,5 @@ private:
TSharedRef<FSocket> _sendSocket;
TArray<TSharedRef<FInternetAddr>> _sendAddresses;
TMap<FString, int32> _sendAddressesIndex;
TArray<OscReceiverInputKey> _keyReceivers;
TArray<std::unique_ptr<OscReceiverInputKey>> _keyReceivers;
};
@@ -6,6 +6,7 @@
/// Base class to receive OSC messages.
struct IOscReceiverInterface
{
virtual ~IOscReceiverInterface() {}
virtual const FString & GetAddressFilter() const = 0;
virtual void SendEvent(const FName & Address, const TArray<FOscDataElemStruct> & Data, const FString & SenderIp) = 0;
};