[Gtk-sharp-list] patch for generator/SignalHandler.cs

Gonzalo Paniagua Javier gonzalo@ximian.com
28 Feb 2003 11:44:40 +0100


El vie, 28 de 02 de 2003 a las 11:13, Petr Danecek escribió:
> Hi,
> in Dispose method of signal callbacks generated by SignalHandler there
> is an incorrect condition statement:
> 
> protected override void Dispose (bool disposing)
> {
> 	_Instances.Remove(_key);
> 	if(_Instances.Count == 0) {
> 		g_signal_handler_disconnect (_raw, _HandlerID);
>                  _Delegate = null;
>         }
> }
> 
> I think that g_signal_handler_disconnect should be called 
> always, not only when the value of the static property _Instances.Count
> is 0. I am also not sure, what is the meaning of the _Delegate = null
> assignment.

Ah. Yes, you are right. g_signal_handler_disconnect should always be
called.

I will apply a slightly modified version of the patch that also calls
base.Dispose (disposing).

Setting managed objects to null when disposing is one way of making GC
life easier.

-Gonzalo