Skip to content

Conversation

quo
Copy link
Contributor

@quo quo commented Jan 7, 2025

Fixes #1617

Not sure whether it would be better to remove the Default impl too, I've kept it for now.

@sdroege
Copy link
Member

sdroege commented Jan 8, 2025

Not sure whether it would be better to remove the Default impl too, I've kept it for now.

That seems OK and simplifies initializing struct fields.

@sdroege sdroege merged commit ced2343 into gtk-rs:main Jan 8, 2025
48 checks passed
@sdroege
Copy link
Member

sdroege commented Jan 8, 2025

Do you also want to add a impl<T: ObjectType> From<T> for SendWeakRef<T> or some other kind of convenience constructor? Seems useful to me at least

@quo
Copy link
Contributor Author

quo commented Jan 8, 2025

SendWeakRef::from(o.downgrade()) is good enough for me. Like you said, usually async channels are cleaner, so SendWeakRef probably shouldn't see all that much use.

If you do want to add a nicer API, I would make it similar to the WeakRef API. So something like obj.downgrade_send(), or obj.downgrade().send(), or maybe obj.ref_send() or obj.as_send()?

@sdroege
Copy link
Member

sdroege commented Jan 10, 2025

Ok, let's keep it like this then :)

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.

[BUG] SendWeakRef is unsound

2 participants