platform: initialize NMLinuxPlatform in constructed() method

setup() can be used to initialize a NMPlatform instance that is
registered as singleton via nm_platform_setup(). It should not
be used to initialize the object.

Prior to c6529a9d74, this change was
not possible because constructed() will call back into nm_platform_*()
functions, without having the singleton instance setup.
This commit is contained in:
Thomas Haller
2015-04-18 12:53:45 +02:00
parent 4526b55a51
commit dc9b25f161
2 changed files with 9 additions and 9 deletions

View File

@@ -4476,9 +4476,10 @@ nm_linux_platform_init (NMLinuxPlatform *platform)
{
}
static gboolean
setup (NMPlatform *platform)
static void
constructed (GObject *_object)
{
NMPlatform *platform = NM_PLATFORM (_object);
NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform);
const char *udev_subsys[] = { "net", NULL };
GUdevEnumerator *enumerator;
@@ -4575,7 +4576,7 @@ setup (NMPlatform *platform)
priv->wifi_data = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) wifi_utils_deinit);
return TRUE;
G_OBJECT_CLASS (nm_linux_platform_parent_class)->constructed (_object);
}
static void
@@ -4610,10 +4611,9 @@ nm_linux_platform_class_init (NMLinuxPlatformClass *klass)
g_type_class_add_private (klass, sizeof (NMLinuxPlatformPrivate));
/* virtual methods */
object_class->constructed = constructed;
object_class->finalize = nm_linux_platform_finalize;
platform_class->setup = setup;
platform_class->sysctl_set = sysctl_set;
platform_class->sysctl_get = sysctl_get;