Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#16067 closed defect (fixed)

dojox/mobile/_ItemBase.onTouchStart() is running setTimeout() callback even if the widget has been destroyed

Reported by: Ed Chatelain Owned by: Eric Durocher
Priority: high Milestone: 1.9
Component: DojoX Mobile Version: 1.8.0
Keywords: Cc:
Blocked By: Blocking:

Description

_ItemBase.onTouchStart() is running setTimeout() callback even if the widget has been destroyed. In a dojox/mvc/test we had to add code to avoid a JavaScript? error in our "delete" code because this line is being called even if the item has been destroyed. this._selTimer = setTimeout(lang.hitch(this, function(){ this.set("selected", true); }), 100);

To see the problem you can update dojox/mvc/tests/mobile/demo/src.js and comment out the aspect.around(ListItem?... code, then hit dojox/mvc/tests/mobile/demo/demo.html and select the "WidgetList? Data Binding" item, then select the delete icon.

_ItemBase should be checking this so that we would not have to check it in out testcase.

Attachments (2)

patch16067.patch (835 bytes) - added by Adrian Vasiliu 7 years ago.
_ItemBase: avoid the risk of running the setTimeout function on destroyed widgets - Adrian Vasiliu, IBM, CCLA
patch16067-fix.patch (838 bytes) - added by Adrian Vasiliu 7 years ago.
Fix and cleanup - Adrian Vasiliu (IBM, CCLA)

Download all attachments as: .zip

Change History (9)

comment:1 Changed 7 years ago by cjolif

Priority: undecidedhigh

_WidgetBase.defer should probably be used instead of setTimeout.

Last edited 7 years ago by cjolif (previous) (diff)

comment:2 Changed 7 years ago by Adrian Vasiliu

Thanks Ed for pointing it out. Once the patch will be committed, you can remove your workaround...

comment:3 Changed 7 years ago by ykami

The patch looks good, thank you. One minor comment is that I wouldn't give a new line for '100);'.

Changed 7 years ago by Adrian Vasiliu

Attachment: patch16067.patch added

_ItemBase: avoid the risk of running the setTimeout function on destroyed widgets - Adrian Vasiliu, IBM, CCLA

comment:4 Changed 7 years ago by Adrian Vasiliu

Okay, I've changed it into '}, 100);' such that it is consistent with the formatting of the this.defer in "handleSelection".

comment:5 Changed 7 years ago by Ed Chatelain

Resolution: fixed
Status: newclosed

In [29748]:

Fixes #16067. _ItemBase: avoid the risk of running the setTimeout function on destroyed widgets. Also remove the workaround in the dojox/mvc test since it is no longer needed. !strict Thanks Adrian Vasiliu (IBM, CCLA).

comment:6 Changed 7 years ago by Ed Chatelain

Milestone: tbd1.9

Changed 7 years ago by Adrian Vasiliu

Attachment: patch16067-fix.patch added

Fix and cleanup - Adrian Vasiliu (IBM, CCLA)

comment:7 Changed 7 years ago by Adrian Vasiliu

In [31203]:

refs #16067. Fix (remove extra function) and cleanup (remove useless lang.hitch). !strict

Note: See TracTickets for help on using tickets.