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

IWeakReferenceSource support #148

Merged
merged 2 commits into from
Mar 29, 2024

Conversation

tristanlabelle
Copy link
Contributor

Implements IWeakReferenceSource on the COM interface that we synthesize for Swift objects sent to WinRT. This allows WinUI to keep weak references to our Swift objects. Also adds tests.

Copy link
Contributor Author

@tristanlabelle tristanlabelle left a comment

Choose a reason for hiding this comment

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

@stevenbrix I think I have most of the implementation but I'm blocked at this point. When I start going down the WeakReferenceSource creation, I don't have a COM object anymore and eventually I need it again for queryInterface implementations. I don't understand how it works in this codebase.

swiftwinrt/Resources/Support/IWeakReferenceSource.swift Outdated Show resolved Hide resolved
swiftwinrt/Resources/Support/IWeakReference.swift Outdated Show resolved Hide resolved
swiftwinrt/Resources/Support/IWeakReference.swift Outdated Show resolved Hide resolved
@tristanlabelle tristanlabelle marked this pull request as ready for review March 29, 2024 17:24
@tristanlabelle tristanlabelle requested a review from a team as a code owner March 29, 2024 17:24
Copy link
Collaborator

@stevenbrix stevenbrix left a comment

Choose a reason for hiding this comment

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

nice! does this change make it possible to add a public WeakReference<T: IWinRTObject> so that we can keep WinRT weak references to objects?

@tristanlabelle
Copy link
Contributor Author

nice! does this change make it possible to add a public WeakReference<T: IWinRTObject> so that we can keep WinRT weak references to objects?

@stevenbrix No, I think that implementation would look quite different, and likely much simpler.

@tristanlabelle tristanlabelle force-pushed the tristan/IWeakReferenceSource-support branch from 06b1d1a to 26a9131 Compare March 29, 2024 19:43
@tristanlabelle tristanlabelle merged commit d7683d3 into main Mar 29, 2024
1 check passed
@tristanlabelle tristanlabelle deleted the tristan/IWeakReferenceSource-support branch March 29, 2024 19:59
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