Summary: | [ABI break] Tp-glib shared lib calls exit() | ||
---|---|---|---|
Product: | Telepathy | Reporter: | Brian Pepple <bpepple> |
Component: | tp-glib | Assignee: | Telepathy bugs list <telepathy-bugs> |
Status: | RESOLVED DUPLICATE | QA Contact: | Telepathy bugs list <telepathy-bugs> |
Severity: | normal | ||
Priority: | medium | ||
Version: | unspecified | ||
Hardware: | Other | ||
OS: | All | ||
Whiteboard: | ABI-break | ||
i915 platform: | i915 features: | ||
Bug Depends on: | 24114 | ||
Bug Blocks: | |||
Attachments: | Patch to remove exit and return NULL in tp_get_bus in case of error.\ |
Description
Brian Pepple
2008-12-01 09:17:26 UTC
Created attachment 21487 [details] [review] Patch to remove exit and return NULL in tp_get_bus in case of error.\ Spicebird is using tp-glib and does more things than just IM. So, when dbus connection fails, we would like handle the error and continue without IM. tp-glib however quits on dbus connection failure. For my purpose, this simple patch that removes the exit statement and returns NULL in tp_get_bus will suffice. I think you shouldn't use that method if you can still continue without dbus connection. Even with your patch you'll get a warning instead of a GError you can report to the user. IMO in most telepathy programs failing at getting the dbus connection is fatal because we can't do anything else (use g_assert instead of exit?). But I agree that we could add another function that is non-fatal and return a GError instead. Probably libempathy should use it too. For example, trying to send a file to a contact from nautilus without dbus running shouldn't terminate nautilus, but an error could be displayed to the user. (In reply to comment #2) > I think you shouldn't use that method if you can still continue without dbus > connection. I didn't consider this because if in future, tp_get_bus changes is behavior, the application might break. Perhaps I should directly use dbus_g_get_bus. > Even with your patch you'll get a warning instead of a GError you > can report to the user. Yes, not returning the GError is not right. > > IMO in most telepathy programs failing at getting the dbus connection is fatal > because we can't do anything else (use g_assert instead of exit?). But I agree > that we could add another function that is non-fatal and return a GError > instead. Probably libempathy should use it too. For example, trying to send a > file to a contact from nautilus without dbus running shouldn't terminate > nautilus, but an error could be displayed to the user. > Using dbus_g_get_bus in Spicebird would be appropriate, yes. We should probably deprecate tp_get_bus in favour of something with error handling. We now have tp_dbus_daemon_dup(), which doesn't call exit(), so here's a branch that marks tp_get_bus() as deprecated: http://git.collabora.co.uk/?p=user/daf/telepathy-glib;a=shortlog;h=refs/heads/deprecate-tp_get_bus You typo'd deprecated, and deprecated functions should have an #ifndef TP_DISABLE_DEPRECATED guard and G_GNUC_DEPRECATED. However, this means we need to eradicate use of tp_get_bus() from telepathy-glib's own examples and tests, and the rest of the Telepathy stack, first (and tbh, deprecating it while still using it in our own CMs would be hypocritical). I'm working on a branch to remove most instances of it from telepathy-glib (IMO we should keep exactly one use of it in the tests, and compile the tests with -Wno-deprecated). tp_get_bus() has been marked deprecated (again) for a while. There is exactly one call to it in the test suite. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.