[Dojo-interest] Destroying dialogs does not run proper teardown procedures (bug 10705)

Rob Gillan rob at mosais.com
Sun Mar 28 02:34:34 EDT 2010


Karl,

There's an attachment to the bug on trac that I assume replicates the  
problem.  One example dialog of ours that causes the onEnd animation  
excemption on second execution is as follows:

	// this function generates the add new alias dialog
	function addEmailAlias() {
		allEmailAddressStore.close();
		domainEmailAddressStore.close();
		emailDomainStore.close();
		if (dijit.byId('newEmailAliasDialog')){
			dijit.byId('newEmailAliasDialog').destroy();
		}
		if (dijit.byId('alias_username')){
			dijit.byId('alias_username').destroy();
		}
		if (dijit.byId('new_alias_address')){
			dijit.byId('new_alias_address').destroy();
		}
		if (dijit.byId('new_alias_domain')){
			dijit.byId('new_alias_domain').destroy();
		}
		newalias_domain = userdomain;
		dialog_content = '<div><table width="100%">'
			+ '<tr><td rowspan="2"><img src="'
			+ gui_uri['graphics_uri'] + graphics['dialog_info']
			+ '" width="40" height="40"><\/td>'
			+ '<td>Email address:&nbsp;<\/td>'
			+ '<td><input dojoType="dijit.form.FilteringSelect" pageSize="10"  
id="alias_username" autoComplete="true"  
store="domainEmailAddressStore" searchAttr="username"
				invalidMessage="invalid email address" value=""><\/td>'
			+ '<td>@<\/td><td>'
			+ userdomain
			+ '<\/td><\/tr>'
			+ '<td>Alias address:&nbsp;<\/td>'
			+ '<td><input dojoType="dijit.form.ValidationTextBox" value=""  
id="new_alias_address" isValid="checkUniqueAliasAddress"
				invalidMessage="this email address already exists"><\/td>'
			+ '<td>@<\/td><td><input dojoType="dijit.form.FilteringSelect"  
name="new_alias_domain" id="new_alias_domain" autoComplete="true"  
store="emailDomainStore"
				searchAttr="domain_name" invalidMessage="invalid domain name"  
value="'
			+ userdomain
			+ '" onChange="setNewAliasDomain()">'
			+ '<\/td><\/tr>'
			+ '<tr><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/ 
td><td style="float:right"><button dojoType="dijit.form.Button"  
type="submit"
				onClick="confirmAddEmailAlias(\''
			+ userdomain
			+ '\')">save<\/button><\/td><\/tr>'
			+ '<\/table><\/div>';
		newEmailAliasDialog = new dijit.Dialog({
			title: 'create a new email alias',
			style: 'width: 559px'
		});
		newEmailAliasDialog.attr("content", dialog_content);
		newEmailAliasDialog.show();
		console.log('newEmailAliasDialog ' + dijit._dialogStack.length);
		dojo.connect(newEmailAliasDialog.domNode, 'oncancel', function(evt)  
{setTimeout("newEmailAliasDialog.destroyRecursive()",1000);});
		dojo.connect(newEmailAliasDialog.onExecute, function(evt)  
{setTimeout("newEmailAliasDialog.destroyRecursive()",1000);});
		currentConnections.push(dojo.connect(newEmailAliasDialog.domNode,  
'onkeypress', function(evt) {
			key = evt.keyCode;
			if (key==dojo.keys.ENTER) {
				setTimeout("newEmailAliasDialog.destroyRecursive()",1000);
				newEmailAliasDialog.execute(confirmAddEmailAlias(userdomain));
			}
		}));
	}

on first dialog display, the console shows the  
dijit._dialogStack.length to be 1.  Opening the dialog again  
immediately has the dijit._dialogStack.length to be 2 once the dialog  
is submitted.

Hope this helps.  If there's anything else please let me know.

Cheers
Rob

On 28/03/2010, at 4:09 PM, Karl Tiedt wrote:

> Can you provide a minified test case that produces this?
>
> -Karl Tiedt
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://docs.dojocampus.org
> Dojo-interest at mail.dojotoolkit.org
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest



More information about the Dojo-interest mailing list