connectivity: only take reference in concheck_cb() if necessary

We don't need to take a reference, if we are not going to emit any signals.
This commit is contained in:
Thomas Haller 2018-04-11 11:27:04 +02:00
parent 5a6fc10000
commit 8e8efbdc32

View file

@ -2499,7 +2499,8 @@ concheck_cb (NMConnectivity *connectivity,
GError *error, GError *error,
gpointer user_data) gpointer user_data)
{ {
gs_unref_object NMDevice *self = NULL; _nm_unused gs_unref_object NMDevice *self_keep_alive = NULL;
NMDevice *self;
NMDevicePrivate *priv; NMDevicePrivate *priv;
NMDeviceConnectivityHandle *handle; NMDeviceConnectivityHandle *handle;
NMDeviceConnectivityHandle *other_handle; NMDeviceConnectivityHandle *other_handle;
@ -2511,7 +2512,7 @@ concheck_cb (NMConnectivity *connectivity,
nm_assert (NM_IS_DEVICE (handle->self)); nm_assert (NM_IS_DEVICE (handle->self));
handle->c_handle = NULL; handle->c_handle = NULL;
self = g_object_ref (handle->self); self = handle->self;
if (nm_utils_error_is_cancelled (error, FALSE)) { if (nm_utils_error_is_cancelled (error, FALSE)) {
/* the only place where we nm_connectivity_check_cancel(@c_handle), is /* the only place where we nm_connectivity_check_cancel(@c_handle), is
@ -2522,6 +2523,8 @@ concheck_cb (NMConnectivity *connectivity,
return; return;
} }
self_keep_alive = g_object_ref (self);
_LOGT (LOGD_CONCHECK, "connectivity: complete check (seq:%llu, state:%s%s%s%s)", _LOGT (LOGD_CONCHECK, "connectivity: complete check (seq:%llu, state:%s%s%s%s)",
(long long unsigned) handle->seq, (long long unsigned) handle->seq,
nm_connectivity_state_to_string (state), nm_connectivity_state_to_string (state),