[
https://issues.apache.org/jira/browse/CB-633?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13267244#comment-13267244
]
Hugo edited comment on CB-633 at 5/3/12 6:32 AM:
-------------------------------------------------
Just looked at the source code for 1.7 and my hunch is that the problem wasn't
fixed because the logic in "Channel.prototype.unsubscribe" allows for negative
values in numHandler, which is the root cause of the problem.
The logic should check that this.numHandlers can never be less than 0. For
example,
if (this.numHandlers > 0 ) {
this.numHandlers--;
}
was (Author: tifroz):
Just looked at the source code for 1.7 and my hunch is that the problem
wasn't fixed because the logic in "Channel.prototype.unsubscribe" allows for
negative values in numHandler, which is the root cause of the problem.
The logic should check that this.numHandlers can never be less than 0. I
believe the code fix should look like this:
<< this.numHandlers--;
>> if (this.numHandlers > 0 ) {
>> this.numHandlers--;
>> }
> overriding backbutton is broken when removeEventListener() is called before
> addEventListener()
> ----------------------------------------------------------------------------------------------
>
> Key: CB-633
> URL: https://issues.apache.org/jira/browse/CB-633
> Project: Apache Callback
> Issue Type: Bug
> Components: Android
> Affects Versions: 1.6.1, 1.7.0
> Reporter: Hugo
> Assignee: Joe Bowser
> Labels: android, backbutton
>
> If document.removeEventListener("backbutton", function(){}, false) is called
> before the addEventListener(), the backbutton default behavior isn't
> overriden.
> To reproduce:
> document.removeEventListener("backbutton", function(){}, false)
> document.addEventListener("backbutton", function(){}, false)
> // ..backbutton default behavior should be overridden (but it's not)
> On the other hand the following will work as expected:
> document.addEventListener("backbutton", function(){}, false)
> // ..ok, backbutton default behavior is overridden
> This is a bigger problem than it looks because developers don't (and
> shouldn't) keep track of how many times removeEventListener() was called
> before calling addEventListener().
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira