Re: [PATCH] Remove idle callbacks in device_removed()
- From: Dan Williams <dcbw redhat com>
- To: Drew Moseley <dmoseley mvista com>
- Cc: networkmanager-list gnome org
- Subject: Re: [PATCH] Remove idle callbacks in device_removed()
- Date: Fri, 06 Feb 2009 15:40:03 -0500
On Tue, 2009-02-03 at 10:59 -0700, Drew Moseley wrote:
> Hello,
>
> I have a scenario where an external script is powering down my
> network device. After the power down the script is restarting
> HAL to work around an issue where occasionally new devices are
> enumerated incorrectly. Periodically this causes Network Manager
> to crash in the idle callback since the device finalize method
> had freed the device data. This patch resolves the issue by
> removing all idle callbacks in the device_removed() function.
> I'm not sure if there are any side effects of doing this though.
This looks like the right thing to do. Thanks for catching it.
However, your patch will remove all pending activations, not just the
ones for the device that just got removed. I've fixed that in the
commit.
Thanks!
Dan
> Comments?
>
> Thanks,
> Drew Moseley
>
> diff --git a/src/NetworkManagerPolicy.c b/src/NetworkManagerPolicy.c
> index 2de01f8..e554d14 100644
> --- a/src/NetworkManagerPolicy.c
> +++ b/src/NetworkManagerPolicy.c
> @@ -860,9 +860,23 @@ static void
> device_removed (NMManager *manager, NMDevice *device, gpointer user_data)
> {
> NMPolicy *policy = (NMPolicy *) user_data;
> - GSList *iter = policy->dev_signal_ids;
> + GSList *iter;
> +
> + /* Clear any idle callbacks for this device */
> + iter = policy->pending_activation_checks;
> + while (iter && iter->data) {
> + ActivateData *data = (ActivateData *) iter->data;
> +
> + g_source_remove (data->id);
> + g_object_unref (data->device);
> + g_free (data);
> + iter = g_slist_next (iter);
> + }
> + g_slist_free (policy->pending_activation_checks);
> + policy->pending_activation_checks = NULL;
>
> /* Clear any signal handlers for this device */
> + iter = policy->dev_signal_ids;
> while (iter) {
> DeviceSignalID *data = (DeviceSignalID *) iter->data;
> GSList *next = g_slist_next (iter)
> _______________________________________________
> NetworkManager-list mailing list
> NetworkManager-list gnome org
> http://mail.gnome.org/mailman/listinfo/networkmanager-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]