Skip to content
  • Philip Withnall's avatar
    libmogwai-schedule: Handle NULL NMConnections on activating connections · 2eb39f6a
    Philip Withnall authored
    
    
    If handling an `NMActiveConnection` which is still activating (in state
    `NM_ACTIVE_CONNECTION_STATE_ACTIVATING`), its `connection` property will
    be `NULL`, rather than pointing to a valid `NMConnection`. Previously,
    we were assuming that it would always point to a valid `NMConnection`,
    and hence were crashing if not.
    
    Handle that case by monitoring state and property change signals from
    `NMActiveConnection` and connecting to the `connection` if it ever
    becomes non-`NULL`. This will likely result in multiple connections to
    the `NMConnection`, but that should be fine — it’ll only result in some
    spurious emissions of `connection-details-changed`, and all the signal
    connections should be dropped when the last reference to the
    `NMConnection` is dropped. We don’t hold that reference.
    
    This is easy to reproduce by having a VPN set up which takes a few
    seconds to connect to. While it’s `ACTIVATING`, `mogwai-scheduled` can
    attempt to query the connection information.
    
    Signed-off-by: default avatarPhilip Withnall <withnall@endlessm.com>
    2eb39f6a