| Summary: | Callback deregistration (rap.off) deletes wrong callback if called multiple times | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Martin Domig <martin> | ||||
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | ivan | ||||
| Version: | 2.3 | ||||||
| Target Milestone: | 3.0 M7 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Thanks for the investigation and the patch. Pending change for RAP 3.0 is waiting the review - https://git.eclipse.org/r/#/c/46639/. Change https://git.eclipse.org/r/#/c/46639/ has been merged. |
Created attachment 252731 [details] Patch that will make possible to call rap.off() multiple times without side effects We use 2 different custom widgets, both of which use a RAP render callback. One of those widgets de-registeres its render callback on the first call: myRender : function() { rap.off('render', this.myRender); // ... some irrelevant stuff here ... } In some circumstances it can happen that the myRender function is called twice (or more times). To reproduce with any custom widget, just duplicate the rap.off() line. On the second call, rap.off() will call rwt.util.Arrays.removeAt( array, index ) with -1 as index, resulting in the callback of the other custom widget being removed. The fix is simple and is actually implemented in the rap.on function just above: do nothing if the index is -1. Patch against 2.3-maintenance attached.