Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR add support for object identity via the
WinRTObject
class.Since WinRT Object's have to keep a strong ref to their identity, in order for it to remain valid during the lifetime of the object. I re-used the same logic we use for
WinRTClass
and made it more generic.When wrapping a swift object. we check if it is a
WinRTObject
if it is, we store the weak reference on the wrapper. When retrieving the abi object, we check if it has identity. if it does.Note: this intentionally doesn't require all objects that implement a
WinRTInterface
to also support the notion of identity. While that is probably a righteous change to eventually have, i went down that route and decided it was slightly too large of a change for nowTesting
Added a couple tests for identity and also added a memory management test to make sure we aren't leaking the
WinRTObject