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

Fix object cloning #989

Merged
merged 1 commit into from
Oct 7, 2021
Merged

Fix object cloning #989

merged 1 commit into from
Oct 7, 2021

Conversation

senderista
Copy link
Contributor

@senderista senderista commented Oct 7, 2021

I finally managed to get this right and all unit tests pass (and my debug allocator in another branch no longer segfaults). The correct pattern here for updating references on an object is incredibly error-prone:

  1. Save the current offset of the object
  2. Clone the object
  3. Modify references
  4. (Coming soon) In debug builds, write-protect the modified object to detect memory corruption
  5. Log the changes, using the current and saved offsets of the object

Some refactoring is definitely in order for V1.

@senderista senderista requested a review from simone-gaia October 7, 2021 11:46
Copy link
Contributor

@simone-gaia simone-gaia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@senderista senderista merged commit c2b5e61 into master Oct 7, 2021
@senderista senderista deleted the tobin/fix_obj_clone branch October 7, 2021 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants