Skip to content

Commit 783ac28

Browse files
committed
Fixed issue with race condition in javascript context. Related to https://groups.google.com/d/msg/codenameone-discussions/HV5Y8pJudBQ/lTvpe-2yEAAJ
1 parent 16c6292 commit 783ac28

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

CodenameOne/src/com/codename1/javascript/JavascriptContext.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,10 @@ public JSObject getWindow() {
406406
*/
407407
public void getAsync(String javascript, final Callback callback) {
408408
final String callbackMethod = "callback$$"+callbackId;
409+
callbackId++;
410+
if (callbackId > 1000) {
411+
callbackId = 0;
412+
}
409413
getWindow().set(callbackMethod, new JSFunction() {
410414

411415
public void apply(JSObject self, Object[] args) {

0 commit comments

Comments
 (0)