Skip to content

Partial fix for issue #390. #399

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

Merged
merged 2 commits into from
Jun 1, 2021
Merged
Changes from 1 commit
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
Next Next commit
Partial fix for issue #390.
  • Loading branch information
vinci6k committed May 22, 2021
commit 3374cecbc5e3277cd2e5e6e9fa305a6e10596cc1
15 changes: 13 additions & 2 deletions addons/source-python/packages/source-python/messages/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,18 @@ def _pre_send_user_message(args):
_recipients.update(*tuple(tmp_recipients), clear=True)
args[1] = _recipients

buffer = make_object(ProtobufMessage, args[3])
try:
buffer = make_object(ProtobufMessage, args[3])
except RuntimeError:
# Patch for issue #390 - UserMessage was created by another plugin.
buffer = UserMessage(
_recipients, get_message_name(message_index)).buffer
buffer_ptr = get_object_pointer(buffer)
buffer_size = get_size(buffer)

orig_buffer_ptr = args[3]
orig_buffer_ptr.copy(buffer_ptr, buffer_size)
buffer_ptr.copy(orig_buffer_ptr, buffer_size)

protobuf_user_message_hooks.notify(_recipients, buffer)

Expand Down Expand Up @@ -270,4 +281,4 @@ def _pre_message_end(args):
# Update buffer if data has been changed
if data.has_been_changed():
buffer_write.seek_to_bit(0)
impl.write(buffer_write, data)
impl.write(buffer_write, data)