diff --git a/ChangeLog b/ChangeLog index 967babd2b5..e9717cd883 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-10-29 Dan Williams + + * src/nm-hal-manager.c + - (device_added, device_new_capability): ignore device additions while + asleep. Fixes crash caused when NM goes to sleep, a network device + kernel module is unloaded and reloaded and recognized by NM again. + 2007-10-26 Dan Williams Patch from Helmut Schaa (and more bits from me) diff --git a/src/nm-hal-manager.c b/src/nm-hal-manager.c index 433c703ecc..d1aedf16f1 100644 --- a/src/nm-hal-manager.c +++ b/src/nm-hal-manager.c @@ -236,6 +236,12 @@ device_added (LibHalContext *ctx, const char *udi) // nm_debug ("New device added (hal udi is '%s').", udi ); + /* Ignore device additions while asleep, all devices will + * be found and set up again on wake. + */ + if (nm_manager_get_state (manager->nm_manager) == NM_STATE_ASLEEP) + return; + /* Sometimes the device's properties (like net.interface) are not set up yet, * so this call will fail, and it will actually be added when hal sets the device's * capabilities a bit later on. @@ -265,6 +271,12 @@ device_new_capability (LibHalContext *ctx, const char *udi, const char *capabili /*nm_debug ("nm_hal_device_new_capability() called with udi = %s, capability = %s", udi, capability );*/ + /* Ignore device additions while asleep, all devices will + * be found and set up again on wake. + */ + if (nm_manager_get_state (manager->nm_manager) == NM_STATE_ASLEEP) + return; + creator_fn = get_creator (manager, udi); if (creator_fn) create_device_and_add_to_list (manager, creator_fn, udi);