Re: Removing the watch_all callback



On Fri, 2009-04-03 at 11:40 -0700, Drew Moseley wrote:
> Hi,
> 
> It looks like hal_deinit() needs to remove the watch_all callback
> that is being installed in hal_init().  The patch below will do
> this.
> 
> Unfortunately that API does not yet exist in HAL.  I've
> submitted that back to the HAL mailing list.  Details are here:
> http://lists.freedesktop.org/archives/hal/2009-April/013157.html
> 
> I discovered this during my stress testing of continually restarting
> HAL.  Eventually, libhal would fail on the 
> libhal_device_property_watch_all() call in hal_init().  With this
> patch (and the corresponding one in my HAL library) I was able to
> restart HAL 1000 times with no issues.

Could instead be a flag in libhal that saves whether or not the watch
has been added, and then just makes subsequent watches a noop.  Then
libhal_ctx_shutdown() should also remove any matches that got added.
WOUldn't need new API at that point, though balancing the add functions
with remove is sensible, just whether you want to go through the trouble
of API additions and backwards compat.

Dan

> Drew
> 
> 
> 
> diff --git a/src/nm-hal-manager.c b/src/nm-hal-manager.c
> index 0ed0f5d..cf6f200 100644
> --- a/src/nm-hal-manager.c
> +++ b/src/nm-hal-manager.c
> @@ -711,6 +711,11 @@ hal_deinit (NMHalManager *self)
>  	NMHalManagerPrivate *priv = NM_HAL_MANAGER_GET_PRIVATE (self);
>  	DBusError error;
>  
> +	libhal_device_property_remove_watch_all (priv->hal_ctx, &error);
> +	if (dbus_error_is_set (&error)) {
> +		nm_error ("libhal_device_property_remove_watch_all(): %s", error.message);
> +	}
> +
>  	if (priv->killswitch_poll_id) {
>  		g_source_remove (priv->killswitch_poll_id);
>  		priv->killswitch_poll_id = 0;
> _______________________________________________
> 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]