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

Remove IUnknownImpl::from_inner_ref as no longer needed #3513

Merged

Conversation

sivadeilra
Copy link
Collaborator

This PR cleans up part of #3055, which improved COM object support.

The IUnknownImpl::from_inner_ref method predates the new ComObject API. It allows unsafe code to cast from &T to &T_Impl. This is a very dangerous operation because it "widens" the pointer; it requires that &T point to a T that is embedded within a T_Impl.

This was necessary for some situations before the new ComObject API, but is is completely unnecessary now. The new ComObject API provides safe ways to do the same thing. Also, this cast is unnecessary because all COM interface trait implementations are done on T_Impl types, not on T, so this method is unnecessary.

Copy link
Collaborator

@kennykerr kennykerr left a comment

Choose a reason for hiding this comment

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

Excellent thanks!

@kennykerr kennykerr changed the title Remove IUnknownImpl::from_inner_ref Remove IUnknownImpl::from_inner_ref as it is no longer needed Feb 24, 2025
@kennykerr kennykerr changed the title Remove IUnknownImpl::from_inner_ref as it is no longer needed Remove IUnknownImpl::from_inner_ref as no longer needed Feb 24, 2025
@kennykerr kennykerr merged commit c1f45a4 into microsoft:master Feb 24, 2025
34 checks passed
@sivadeilra sivadeilra deleted the user/ardavis/remove-from-inner-ref branch February 24, 2025 22:04
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.

3 participants