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 multiple inheritance in mem tracking by dynamic casting pointers to void* #477

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

naalit
Copy link

@naalit naalit commented Dec 19, 2022

Fixes #476 (hopefully, unless I missed something) by inserting dynamic_cast<void*>() everywhere a pointer of non-void* type is passed to the pointer tracker within Ptr.

Copy link
Member

@mercere99 mercere99 left a comment

Choose a reason for hiding this comment

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

This is an interesting fix, and I think it should work cleanly. My instinct was to keep track of all of the conversions and offsets, but that would be a ton of additional bookkeeping. I believe that this fix will do the right job.

@mercere99
Copy link
Member

Looks like tests are failing. Looking more into dynamic_cast, it apparently ONLY works with polymorphic types, so it won't easily solve the problem here. We need to wrap all of the conversions in some type traits tests to make sure they are polymorphic before we try to resolve them. I'll look into it some more (unless you have time to first) and try to get this resolved.

@mercere99 mercere99 self-requested a review December 23, 2022 20:57
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.

Pointer tracking fails to properly account for object address changes with (multiple) inheritance
2 participants