crashfix: using OSC as input key

This commit is contained in:
monsieurgustav
2017-03-18 08:54:52 +01:00
parent 719fd47aa7
commit b09d86fc12
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 // 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));
} }
} }
+1 -1
View File
@@ -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;
}; };