Login Register

Bug in _Widget.destroy() or wrong usage?

Hi,

when I call _Widget.destroy on my Widget I get an error. Telling me that dojo.disconnect() is expecting an array.
Wich I think is right because it expects a handle and a handle is an array.

In the destroy function disconnect is called like this:

dojo.forEach(this._connects, function(array){
                        dojo.forEach(array, dojo.disconnect);
                });

As I see it, there is one forEach too much. Disconnect() is called with the elements of the handle array.

Or am I missing something. So strange that nobody discovered this earlier.
I am using version 0.9, but I downloaded version 1.0.2 and _Widget.destroy looks still the same.

no, it's not a bug. If you

no, it's not a bug. If you look at the connect method in that same file, you'll see it create a handles[] array, push some connections into that, then push the handles[] array into the _connects array, creating an array of arrays, and a double-forEach in destroy to disconnect

Oh, now I understand! Always

Oh, now I understand!

Always connected to events like this:

this._connects.push(dojo.connect(arg1,arg2,arg3,arg4));

Wich is completely wrong :(.

Thanks a lot!