From b75f0e2817fe685f16543be12525c8eb2a0c5b2b Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Fri, 18 Oct 2019 17:04:57 +0200 Subject: [PATCH] lib: Initialise ->priv as soon as possible If properties were to be set during construction, ->priv needs to not be a dangling/NULL pointer after the object initialization. --- libupower-glib/up-client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libupower-glib/up-client.c b/libupower-glib/up-client.c index 26a6af7..5b1585d 100644 --- a/libupower-glib/up-client.c +++ b/libupower-glib/up-client.c @@ -460,7 +460,6 @@ static gboolean up_client_initable_init (GInitable *initable, GCancellable *cancellable, GError **error) { UpClient *client = UP_CLIENT (initable); - client->priv = up_client_get_instance_private (client); /* connect to main interface */ client->priv->proxy = up_exported_daemon_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, @@ -496,6 +495,7 @@ up_client_initable_iface_init (GInitableIface *iface) static void up_client_init (UpClient *client) { + client->priv = up_client_get_instance_private (client); } /*