platform: register singleton instance early with NM_PLATFORM_REGISTER_SINGLETON
Add a construct-only property NM_PLATFORM_REGISTER_SINGLETON to NMPlatform. When set to TRUE, the constructor will self-register to nm_platform_setup(). The reason for this is that the _LOG() macro in NMLinuxPlatform logs the self pointer if the instance is not the singleton instance. During construction, we already have many log lines due to initialization of the instance. These lines all end up qualified with the self pointer. By earlier self-registering, printing the pointer value is omitted. Yes, this patch is really just to prettify logging.
This commit is contained in:
@@ -429,7 +429,9 @@ G_DEFINE_TYPE (NMLinuxPlatform, nm_linux_platform, NM_TYPE_PLATFORM)
|
||||
void
|
||||
nm_linux_platform_setup (void)
|
||||
{
|
||||
nm_platform_setup (g_object_new (NM_TYPE_LINUX_PLATFORM, NULL));
|
||||
g_object_new (NM_TYPE_LINUX_PLATFORM,
|
||||
NM_PLATFORM_REGISTER_SINGLETON, TRUE,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/******************************************************************/
|
||||
|
Reference in New Issue
Block a user