Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#10605 closed defect (fixed)

dijit.form.Textarea doesn't clear _setTimeoutHandle when destroyed

Reported by: robg Owned by: Douglas Hays
Priority: high Milestone: 1.5
Component: Dijit - Form Version: 1.4.0
Keywords: Cc:
Blocked By: Blocking:


When _onInput fires, Textarea sets a callback to _shrink on a timeout (line 71-76 in Textarea.js). When the widget is destroyed, it doesn't clear that timeout so in some cases the browser attempts to fire _shrink on an already-destroyed widget, which results in an error message of 'textarea not found', from line 92 in Textarea.js.

To repro in FF 3.5.7, from a page that includes dojo:

<script type="text/javascript">
dojo.addOnLoad(function () { = new dijit.form.Textarea();
  k.placeAt(dojo.body(), 'last');

then in the firebug console, type:

k.attr('value', 'bar'); k.destroyRecursive();

(it's important that they be executed at the same time)

It's also possible to reproduce the bug without using the firebug console - when it shows up in my code, it shows up without the console - but it's simpler to reproduce this way.

One possible solution to the issue is to add an uninitialize() method to Textarea.js, e.g.:

uninitialize: function(){
  if (this._setTimeoutHandle){

This fixes the issue for me.

Change History (5)

comment:1 Changed 12 years ago by robg

I also noticed that doing

new dijit.form.Textarea().destroyRecursive();

results in a similar timing bug (due to the setTimeout in Textarea.postCreate (line137). But it's probably very unlikely to cause issues.

comment:2 Changed 12 years ago by bill

Owner: set to Douglas Hays

comment:3 Changed 12 years ago by Douglas Hays

Milestone: tbd1.5

comment:4 Changed 12 years ago by Douglas Hays

Resolution: fixed
Status: newclosed

(In [21273]) Fixes #10605. Clear settimeout handle during widget teardown

comment:5 Changed 11 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.