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 674720 - segfault when running test-agent with no adapter present
segfault when running test-agent with no adapter present
Status: RESOLVED FIXED
Product: gnome-bluetooth
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-bluetooth-general-maint@gnome.bugs
gnome-bluetooth-general-maint@gnome.bugs
Depends on:
Blocks:
 
 
Reported: 2012-04-24 13:17 UTC by Daniele Forsi
Modified: 2012-04-25 13:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Check if priv->adapter is NULL before continuing (2.14 KB, patch)
2012-04-24 13:17 UTC, Daniele Forsi
needs-work Details | Review
lib: check if an adapter is present before trying to register the agent (1.51 KB, patch)
2012-04-25 12:27 UTC, Daniele Forsi
committed Details | Review

Description Daniele Forsi 2012-04-24 13:17:25 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.
Comment 1 Daniele Forsi 2012-04-25 10:01:45 UTC
Review of attachment 212701 [details] [review]:

I'm going to split unrelated changes.
Comment 2 Daniele Forsi 2012-04-25 12:27:31 UTC
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 3 Daniele Forsi 2012-04-25 13:20:36 UTC
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