core: don't set "startup complete" until devices have been added (rh #1256772)

check_if_startup_complete() could be invoked from nm_settings_start() before
devices had chance to be added, which results in premature "startup complete"
and NM would quit when configure-and-quit=yes is set up.
Postpone actual check_if_startup_complete() resolution until we add all devices
and they are processed.

 (gdb) bt
 #0  0x00005555556401f3 in check_if_startup_complete (self=0x5555559f91d0)
     at nm-manager.c:719
 #1  0x00007ffff4d69de8 in g_closure_invoke () at /lib64/libgobject-2.0.so.0
 #2  0x00007ffff4d7b70d in signal_emit_unlocked_R ()
     at /lib64/libgobject-2.0.so.0
 #3  0x00007ffff4d83471 in g_signal_emit_valist () at /lib64/libgobject-2.0.so.0
 #4  0x00007ffff4d8372f in g_signal_emit () at /lib64/libgobject-2.0.so.0
 #5  0x00007ffff4d6e4b5 in g_object_dispatch_properties_changed ()
     at /lib64/libgobject-2.0.so.0
 #6  0x00007ffff4d709d9 in g_object_notify () at /lib64/libgobject-2.0.so.0
 #7  0x00005555556e232c in check_startup_complete (self=self@entry=0x555555a0e130) at settings/nm-settings.c:204
 #8  0x00005555556e5203 in nm_settings_start (self=0x555555a0e130, error=error@entry=0x7fffffffe658) at settings/nm-settings.c:2122
 #9  0x0000555555646d06 in nm_manager_start (self=0x5555559f91d0, error=0x7fffffffe658) at nm-manager.c:4153
 #10 0x00005555555add43 in main (argc=1, argv=0x7fffffffe7c8) at main.c:428
 (gdb)

Fixes:Beaker:NetworkManager_Test37_run_once_new_connection

https://bugzilla.redhat.com/show_bug.cgi?id=1256772

(cherry picked from commit 7edb53f660)
This commit is contained in:
Jiří Klimeš 2015-08-25 13:32:53 +02:00
parent e16ebfb4a6
commit 98a560258a

View file

@ -194,6 +194,7 @@ typedef struct {
guint timestamp_update_id;
gboolean startup;
gboolean devices_inited;
} NMManagerPrivate;
#define NM_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_MANAGER, NMManagerPrivate))
@ -743,6 +744,9 @@ check_if_startup_complete (NMManager *self)
if (!priv->startup)
return;
if (!priv->devices_inited)
return;
if (!nm_settings_get_startup_complete (priv->settings)) {
nm_log_dbg (LOGD_CORE, "check_if_startup_complete returns FALSE because of NMSettings");
return;
@ -4206,6 +4210,8 @@ nm_manager_start (NMManager *self)
*/
system_create_virtual_devices (self);
priv->devices_inited = TRUE;
check_if_startup_complete (self);
}