udev/trivial: rename nm_udev_client_unref() to nm_udev_client_destory()
NMUdevClient does not actually implement ref-counting, because it's not used. Still, the destroy function was named nm_udev_client_unref(), because theoretically then we could later, as the need arises, make the type ref-counted. Then unref function already had the right name. However, NMUdevClient also has a callback function that emits monitor events. Again for simplicity, this callback function cannot be reset, it can only be set once (in the constructor) and can also not be unset nor disabled. When the user of NMUdevClient is done with the instance and calls "unref", then it must be sure that the callback is no longer invoked afterwards. In practice that is already the case, but "unref" makes it sound as if somebody else could also still hold a reference -- in which case the user would have to first unset/disable the callback. Rename the function to "destroy()", so that it's clear that the instance is gone afterwards and that the callback will not be invoked anymore.
This commit is contained in:
@@ -241,11 +241,11 @@ nm_udev_client_new(const char *const *subsystems,
|
||||
return self;
|
||||
|
||||
fail:
|
||||
return nm_udev_client_unref(self);
|
||||
return nm_udev_client_destroy(self);
|
||||
}
|
||||
|
||||
NMUdevClient *
|
||||
nm_udev_client_unref(NMUdevClient *self)
|
||||
nm_udev_client_destroy(NMUdevClient *self)
|
||||
{
|
||||
if (!self)
|
||||
return NULL;
|
||||
|
@@ -24,7 +24,7 @@ NMUdevClient *nm_udev_client_new(const char *const *subsystems,
|
||||
NMUdevClientEvent event_handler,
|
||||
gpointer event_user_data);
|
||||
|
||||
NMUdevClient *nm_udev_client_unref(NMUdevClient *self);
|
||||
NMUdevClient *nm_udev_client_destroy(NMUdevClient *self);
|
||||
|
||||
struct udev *nm_udev_client_get_udev(NMUdevClient *self);
|
||||
|
||||
|
@@ -253,7 +253,7 @@ dispose(GObject *object)
|
||||
g_object_weak_unref(G_OBJECT(iter->data), device_destroyed, self);
|
||||
nm_clear_pointer(&priv->devices, g_slist_free);
|
||||
|
||||
priv->udev_client = nm_udev_client_unref(priv->udev_client);
|
||||
priv->udev_client = nm_udev_client_destroy(priv->udev_client);
|
||||
|
||||
G_OBJECT_CLASS(nm_atm_manager_parent_class)->dispose(object);
|
||||
}
|
||||
|
@@ -405,7 +405,7 @@ dispose(GObject *object)
|
||||
priv->killswitches = NULL;
|
||||
}
|
||||
|
||||
priv->udev_client = nm_udev_client_unref(priv->udev_client);
|
||||
priv->udev_client = nm_udev_client_destroy(priv->udev_client);
|
||||
|
||||
G_OBJECT_CLASS(nm_rfkill_manager_parent_class)->dispose(object);
|
||||
}
|
||||
|
@@ -9593,7 +9593,7 @@ finalize(GObject *object)
|
||||
g_hash_table_destroy(priv->sysctl_get_prev_values);
|
||||
}
|
||||
|
||||
priv->udev_client = nm_udev_client_unref(priv->udev_client);
|
||||
priv->udev_client = nm_udev_client_destroy(priv->udev_client);
|
||||
|
||||
G_OBJECT_CLASS(nm_linux_platform_parent_class)->finalize(object);
|
||||
}
|
||||
|
@@ -611,7 +611,7 @@ main(int argc, char **argv)
|
||||
global.udev_devices = g_list_delete_link(global.udev_devices, global.udev_devices);
|
||||
}
|
||||
|
||||
nm_udev_client_unref(udev_client);
|
||||
nm_udev_client_destroy(udev_client);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user