Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CP #1610 > support/v5.13] [c#] Do not reuse Protobuf message objects in callbacks #1614

Merged
merged 1 commit into from
May 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions lang/csharp/Continental/eCAL/Protobuf/ProtoSubscriber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ public ReceiveCallbackData()
}
};

private ReceiveCallbackData receivedData;

/**
* @brief Signature for a data callback.
**/
Expand All @@ -50,7 +48,6 @@ public ProtobufSubscriber(string topicName)
{
T msg = new T();
binarySubscriber = new Subscriber(topicName, Common.ProtobufHelper.GetProtoMessageTypeName(msg), Common.ProtobufHelper.GetProtoMessageDescription(msg));
receivedData = new ReceiveCallbackData();
}

/**
Expand Down Expand Up @@ -83,6 +80,7 @@ private void callBack(String topic, Core.Subscriber.ReceiveCallbackData data)
byte[] messageBytes = Encoding.Default.GetBytes(data.data);
MemoryStream msgStream = new MemoryStream(messageBytes);

var receivedData = new ReceiveCallbackData();
receivedData.data.MergeFrom(msgStream);
receivedData.id = data.id;
receivedData.clock = data.clock;
Expand Down
Loading