GNOME Bugzilla – Bug 674720
segfault when running test-agent with no adapter present
Last modified: 2012-04-25 13:57:30 UTC
Created attachment 212701 [details] [review] Check if priv->adapter is NULL before continuing When running test-agent with my BT dongle unplugged I got some critical warnings and eventually a segfault. The segfault is due to g_dbus_connection_register_object() returning and error indication with a NULL pointer (see bug #674717), however there is no point in continuing when adapter is NULL. The applet isn't affected because it calls bluetooth_agent_register() only if adapter is not NULL. (process:5950): GLib-GIO-CRITICAL **: g_dbus_proxy_get_object_path: assertion `G_IS_DBUS_PROXY (proxy)' failed (process:5950): GLib-CRITICAL **: g_path_get_basename: assertion `file_name != NULL' failed (process:5950): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion `object_path != NULL && g_variant_is_object_path (object_path)' failed Program received signal SIGSEGV, Segmentation fault. 0xb7fc943c in bluetooth_agent_register (agent=0x8053420) at bluetooth-agent.c:462 462 g_warning ("Failed to register object: %s", error->message); (gdb) print error $1 = (GError *) 0x0 (gdb) The change to test-agent.c is made to avoid entering a main loop that would get no event.
Review of attachment 212701 [details] [review]: I'm going to split unrelated changes.
Created attachment 212770 [details] [review] lib: check if an adapter is present before trying to register the agent Fixes the following warnings and segfault when running test-agent with no adapter present: (process:5950): GLib-GIO-CRITICAL **: g_dbus_proxy_get_object_path: assertion `G_IS_DBUS_PROXY (proxy)' failed (process:5950): GLib-CRITICAL **: g_path_get_basename: assertion `file_name != NULL' failed (process:5950): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion `object_path != NULL && g_variant_is_object_path (object_path)' failed Program received signal SIGSEGV, Segmentation fault. 0xb7fc943c in bluetooth_agent_register (agent=0x8053420) at bluetooth-agent.c:462 462 g_warning ("Failed to register object: %s", error->message); (gdb) print error $1 = (GError *) 0x0 (gdb)
Comment on attachment 212770 [details] [review] lib: check if an adapter is present before trying to register the agent Attachment 212770 [details] pushed as ad2395b - lib: check if an adapter is present before trying to register the agent