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

Expose dbus_register and dbus_unregister vfuncs #1634

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

swsnr
Copy link
Contributor

@swsnr swsnr commented Jan 18, 2025

Using this vfunc makes exporting objects on the app's bus name much easier and more reliable.

I've rewritten the corresponding example to use these two methods, as the GIO docs recommend to use these vfuncs for object registration. Also, registering an object in startup is prone to race conditions wrt to bus ownership as the object gets registered only after the application claimed the bus name.

@swsnr
Copy link
Contributor Author

swsnr commented Jan 18, 2025

This is my first time doing glib FFI, so I'd like ask for a careful review, especially around ownership of pointers.

If this is accepted I'd very much appreciate a timely backport and release, as I need this to reliably export an object on the bus in my code.

@swsnr
Copy link
Contributor Author

swsnr commented Jan 18, 2025

Mmh, did I cause this CI error?

@sdroege
Copy link
Member

sdroege commented Jan 21, 2025

Mmh, did I cause this CI error?

No, the docs job is just randomly failing.

Copy link
Member

@sdroege sdroege left a comment

Choose a reason for hiding this comment

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

Looks good to me otherwise, thanks :)

@swsnr swsnr force-pushed the dbus_register_vfunc branch from 179386b to f40c7d4 Compare January 21, 2025 22:58
@swsnr
Copy link
Contributor Author

swsnr commented Jan 21, 2025

@bilelmoussaoui @sdroege I think I addressed everything. I added name_lost too; I hope I did it right, because I didn't really understand what the return value does and it doesn't seem to be documented 🤷

@swsnr swsnr force-pushed the dbus_register_vfunc branch from 77d82c5 to 325e4c0 Compare January 22, 2025 06:42
@swsnr swsnr force-pushed the dbus_register_vfunc branch from 325e4c0 to e7fef77 Compare January 22, 2025 20:31
swsnr added 4 commits January 22, 2025 21:32
This is more in line how application classes would be used in real world
applications which usually create a derived application class which
holds the overall state.

And it prepares for testing the dbus_register vfunc subsequently.
@swsnr swsnr force-pushed the dbus_register_vfunc branch from e7fef77 to 00fe956 Compare January 22, 2025 20:32
Copy link
Contributor Author

@swsnr swsnr left a comment

Choose a reason for hiding this comment

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

I've addressed all remarks, changed the return value of name_lost to Propagation, and rebased onto main.

@swsnr
Copy link
Contributor Author

swsnr commented Jan 23, 2025

While I was at it I've pushed another commit which replaces the IOErrorEnum's in the DBus example with DBusError which seemed more appropriate.

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