g_dbus_object_get_object_path is not thread-safe for GDBusObjectSkeleton
Submitted by Stef Walter
Assigned to David Zeuthen
Link to original bug (#682076)
Description
g_dbus_object_skeleton_get_object_path() (the vfunc implemantion for GDBusObject.get_object_path()) is not thread-safe. It uses locking, but the returned value can easily be freed while in use (eg: whenever g_dbus_object_skeleton_set_object_path() frees it).
Seems it's hard to fix this. Some possible solutions:
- GDBusObjectSkeleton doesn't free any of the object paths that were set on it until it was finalize.
- Use g_string_intern(), although this essentially leaks until process exit.
- Document the gotcha on all possible setters and getters of this property,
such as:
- g_dbus_object_get_object_path()
- g_dbus_object_skeleton_set_object_path()
- GDBusObject:g-object-path
- g_dbus_object_manager_server_export_uniquely(),