Opened 6 years ago

Closed 6 years ago

#17701 closed defect (invalid)

_WidgetBase.js [173] destroy function | Dojo 1.7.2

Reported by: GuyT07 Owned by: GuyT07
Priority: undecided Milestone: tbd
Component: Dijit Version: 1.7.5
Keywords: Cc:
Blocked By: Blocking:

Description

Dear Dojo developers

I've found a probably bug in Dojo 1.7.2. It's on line 178. I've put the specific code fragment below:

var c;
while ((c = this._connects.pop())) {
    c.remove();
}

The problem is that I've got an array in the 'this._connects' array instead of an object(it is an array with objects). Then, when you pass the array to c and the 'c.remove()' method has to be executed you get an 'remove() undefined' error because the array itself contains not method 'remove' but the objects inside this array have this method. So not sure if this is a bug or an error in my program logic.

Sincerely

Guy

Attachments (1)

dojo.png (24.6 KB) - added by GuyT07 6 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 6 years ago by ben hockey

Owner: set to GuyT07
Status: newpending

how did you get an array in this._connects? do you have some sample code to demonstrate?

Changed 6 years ago by GuyT07

Attachment: dojo.png added

comment:2 Changed 6 years ago by GuyT07

Status: pendingnew

Attachment (dojo.png) added by ticket reporter.

comment:3 Changed 6 years ago by GuyT07

I can't post the full code of the project because it's over 1GB of JS files and it depends on our custom framework(I've no permission to publish that;)). I can show you how it's used in our code:

var h1 = dojo.connect(this.sizeHandle.domNode, "onmousedown", this, function(e){
			this._resizeEnd = dojo.connect(document, "onmouseup", this, function(e){
			                                   dojo.disconnect(this._resizeEnd);
				                           this.resize();
			                  });
	});
		
if(dojo.isIE){
    var h2 = dojo.connect(this.domNode,'onresize',this,"_onResize");
}		
var h3 = dojo.connect(window,'onresize', this, "_onWindowResize"); 
this._connects.push([h1, h2, h3]);

I've attached an image of the debugging result.

comment:4 Changed 6 years ago by bill

Resolution: invalid
Status: newclosed

Surely it's from this strange line in your code:

this._connects.push([h1, h2, h3]);

Presumably this would work better:

this._connects = this._connects.concat([h1, h2, h3]);

However, directly modifying the private variable this._connects is unsupported and will not work in the future.

You should really be using this.connect(), not dojo.connect(). this.connect() will automatically track the handle and release it when the widget is destroyed.

Note: See TracTickets for help on using tickets.