device: don't assert the presence of old vpn configurations
authorBeniamino Galvani <bgalvani@redhat.com>
Mon, 7 Mar 2016 17:14:30 +0000 (18:14 +0100)
committerBeniamino Galvani <bgalvani@redhat.com>
Mon, 7 Mar 2016 17:22:12 +0000 (18:22 +0100)
When a VPN connection is active and the parent device becomes
unmanaged (due to device removal or system entering sleep), all
configurations are removed from the interface and the device is taken
down. After that, the VPN is disconnected and tries to remove the old
VPN configuration from device, causing the following assertion to
fail:

  _replace_vpn_config_in_list: assertion '!old' failed

Remove the assertion as @old can be missing for valid reasons.

src/devices/nm-device.c

index 4502cf5..a25830a 100644 (file)
@@ -7926,9 +7926,10 @@ _replace_vpn_config_in_list (GSList **plist, GObject *old, GObject *new)
 {
        GSList *old_link;
 
-       /* Below, assert that we have an @old instance to replace and that
-        * @new is not yet tracked. But still, behave correctly in any
-        * case. */
+       /* Below, assert that @new is not yet tracked, but still behave
+        * correctly in any case. Don't complain for missing @old since
+        * it could have been removed when the parent device became
+        * unmanaged. */
 
        if (   old
            && (old_link = g_slist_find (*plist, old))) {
@@ -7947,12 +7948,9 @@ _replace_vpn_config_in_list (GSList **plist, GObject *old, GObject *new)
                        *plist = g_slist_append (*plist, g_object_ref (new));
                else
                        g_return_val_if_reached (TRUE);
-               g_return_val_if_fail (!old, TRUE);
                return TRUE;
        }
 
-       /* return FALSE if both @old and @new are unset. */
-       g_return_val_if_fail (!old, FALSE);
        return FALSE;
 }