Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#15064 closed defect (fixed)

better handling of setTimeout in mobile

Reported by: ben hockey Owned by: Adrian Vasiliu
Priority: undecided Milestone: 1.9
Component: DojoX Mobile Version: 1.7.2
Keywords: Cc:
Blocked By: Blocking:

Description

the setTimeout calls used extensively throughout dojox/mobile (particularly the longer ones) should be tracked and if there are any outstanding timeouts when a widget is destroyed, those should be cleared. _WidgetBase has a defer function to help with this that might be useful.

in particular, there is one specific call in _ItemBase that is constantly causing problems in an app i'm working on when the widgets are destroyed before that setTimeout completes:

setTimeout(function(){
        _this.set("selected", false);
}, this._duration);

this._duration is 800ms by default and by the time that function is called, the domNode has been set to null and causes all kinds of problems. this setTimeout should be cleared in the destroy of the widget.

Attachments (4)

patch15064.patch (31.9 KB) - added by Adrian Vasiliu 7 years ago.
Use of widget.defer() instead of setTimeout. This fixes some cases of failures when destroying the widget. Includes DOH testing. - Adrian Vasiliu (IBM, CCLA)
patch15064-fix.patch (1.8 KB) - added by Adrian Vasiliu 7 years ago.
Fix in previous patch (removal of widget.defer) - Adrian Vasiliu (IBM, CCLA)
patch15064-fix2.patch (7.2 KB) - added by Adrian Vasiliu 7 years ago.
Remove unnecessary lang.hitch when using widget.defer (done anyway internally by widget.defer) - Adrian Vasiliu (IBM, CCLA)
patch15064-fix3.patch (2.2 KB) - added by Adrian Vasiliu 7 years ago.
scrollable: do not use widget.defer() because this module is not always mixed into a widget - Adrian Vasiliu (IBM, CCLA)

Download all attachments as: .zip

Change History (12)

comment:1 Changed 8 years ago by bill

You should use _WidgetBase::defer() (added by Doug).

comment:2 Changed 7 years ago by cjolif

Milestone: tbd1.9
Owner: changed from ykami to Eric Durocher
Status: newassigned

I think this one was fixed to use defer(). Eric can you check if we have other ones that should use defer() and are not? And if yes I think it would be good to have them fixed in 1.9.

comment:3 Changed 7 years ago by Eric Durocher

Owner: changed from Eric Durocher to Adrian Vasiliu

Changed 7 years ago by Adrian Vasiliu

Attachment: patch15064.patch added

Use of widget.defer() instead of setTimeout. This fixes some cases of failures when destroying the widget. Includes DOH testing. - Adrian Vasiliu (IBM, CCLA)

comment:4 Changed 7 years ago by cjolif

Resolution: fixed
Status: assignedclosed

In [30907]:

fixes #15064. Use of widget.defer() instead of setTimeout. This fixes some cases of failures when destroying the widget. Thanks Adrian Vasiliu (IBM, CCLA). !strict

comment:5 Changed 7 years ago by cjolif

In [30908]:

fixes #15064. Use of widget.defer() instead of setTimeout. This fixes some cases of failures when destroying the widget. Test cases. Thanks Adrian Vasiliu (IBM, CCLA). !strict.

Changed 7 years ago by Adrian Vasiliu

Attachment: patch15064-fix.patch added

Fix in previous patch (removal of widget.defer) - Adrian Vasiliu (IBM, CCLA)

comment:6 Changed 7 years ago by cjolif

In [30918]:

refs #15064. properly remove the timeout now that they are fire by this.defer(). Thanks Adrian Vasiliu (IBM, CCLA)

Changed 7 years ago by Adrian Vasiliu

Attachment: patch15064-fix2.patch added

Remove unnecessary lang.hitch when using widget.defer (done anyway internally by widget.defer) - Adrian Vasiliu (IBM, CCLA)

comment:7 Changed 7 years ago by Patrick Ruzand

In [30920]:

Remove unnecessary lang.hitch when using widget.defer, fixes #15064, thx Adrian Vasiliu (CCLA) !strict

Changed 7 years ago by Adrian Vasiliu

Attachment: patch15064-fix3.patch added

scrollable: do not use widget.defer() because this module is not always mixed into a widget - Adrian Vasiliu (IBM, CCLA)

comment:8 Changed 7 years ago by Adrian Vasiliu

(committed in [30956])

Note: See TracTickets for help on using tickets.