After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 753278 - gdbus: Don't use g_assert_no_error() GDBusObjectManagerServer
gdbus: Don't use g_assert_no_error() GDBusObjectManagerServer
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gdbus
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Colin Walters
gtkdev
: 680533 730388 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2015-08-05 11:28 UTC by Stef Walter
Modified: 2017-11-03 16:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gdbus: Don't use g_assert_no_error() GDBusObjectManagerServer (1.94 KB, patch)
2015-08-05 11:29 UTC, Stef Walter
accepted-commit_now Details | Review

Description Stef Walter 2015-08-05 11:28:46 UTC
There are real world cases where emitting signals can fail, such
as if the DBus connection closes. Asserting and aborting the process
in these cases is just plain lazy.

Ignore the errors when the connection is closed, and turn the 
others into warnings.
Comment 1 Stef Walter 2015-08-05 11:29:09 UTC
This happened in Cockpit by the way. Found during testing, but likely also shows up in the real world.
Comment 2 Stef Walter 2015-08-05 11:29:31 UTC
Created attachment 308783 [details] [review]
gdbus: Don't use g_assert_no_error() GDBusObjectManagerServer

There are real world cases where emitting signals can fail, such
as if the DBus connection closes. Asserting and aborting the process
in these cases is just plain lazy.

Ignore the errors when the connection is closed, and turn the
others into warnings.
Comment 3 Matthias Clasen 2015-08-05 11:36:46 UTC
Review of attachment 308783 [details] [review]:

I agree
Comment 4 Marius Vollmer 2015-08-05 11:42:24 UTC
Review of attachment 308783 [details] [review]:

::: gio/gdbusobjectmanagerserver.c
@@ +969,3 @@
+  if (error && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CLOSED))
+    {
+      g_warning ("Couldn't emit InterfacesAdded signal: %s", error->message);

s/Added/Removed/
Comment 5 Marius Vollmer 2015-08-05 11:42:26 UTC
Review of attachment 308783 [details] [review]:

::: gio/gdbusobjectmanagerserver.c
@@ +969,3 @@
+  if (error && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CLOSED))
+    {
+      g_warning ("Couldn't emit InterfacesAdded signal: %s", error->message);

s/Added/Removed/
Comment 6 Stef Walter 2015-08-05 11:43:39 UTC
Merged with Marius' typo fix.

Attachment 308783 [details] pushed as b3fcb14 - gdbus: Don't use g_assert_no_error() GDBusObjectManagerServer
Comment 7 Christian Persch 2015-08-05 19:57:12 UTC
If error is set and it *is* G_IO_ERROR_CLOSED, then the GError is leaked.
Comment 8 Matthias Clasen 2015-08-05 21:15:27 UTC
please always reopen
Comment 9 Stef Walter 2015-08-06 06:14:16 UTC
Thanks for fixing that.
Comment 10 Philip Withnall 2017-11-03 13:59:09 UTC
*** Bug 680533 has been marked as a duplicate of this bug. ***
Comment 11 Philip Withnall 2017-11-03 16:03:47 UTC
*** Bug 730388 has been marked as a duplicate of this bug. ***