devices: fix recursive-state-change check

nm_device_state_changed() had a check to make sure it wasn't entered
recursively (which had been a source of bugs in the past), but it was
global rather than per-device, so it caused errors when VLANs changed
state in response to their parent device changing state. Fix that.

https://bugzilla.gnome.org/show_bug.cgi?id=698619
This commit is contained in:
Dan Winship 2013-05-20 16:15:37 -03:00
parent 2bb5178897
commit fd2a3a7561

View file

@ -166,6 +166,7 @@ typedef struct {
typedef struct {
gboolean disposed;
gboolean initialized;
gboolean in_state_changed;
NMDeviceState state;
NMDeviceStateReason state_reason;
@ -5436,10 +5437,8 @@ nm_device_state_changed (NMDevice *device,
NMConnection *connection;
/* Track re-entry */
static gboolean in_state_changed = FALSE;
g_warn_if_fail (in_state_changed == FALSE);
in_state_changed = TRUE;
g_warn_if_fail (priv->in_state_changed == FALSE);
priv->in_state_changed = TRUE;
g_return_if_fail (NM_IS_DEVICE (device));
@ -5449,7 +5448,7 @@ nm_device_state_changed (NMDevice *device,
*/
if ( (priv->state == state)
&& !(state == NM_DEVICE_STATE_UNAVAILABLE && priv->firmware_missing)) {
in_state_changed = FALSE;
priv->in_state_changed = FALSE;
return;
}
@ -5590,7 +5589,7 @@ nm_device_state_changed (NMDevice *device,
if (req)
g_object_unref (req);
in_state_changed = FALSE;
priv->in_state_changed = FALSE;
}
static gboolean