From 7bd17cc570088b25941d3862dfd95906a120d822 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Manuel=20Carrasco=20Mo=C3=B1ino?= Date: Wed, 27 Feb 2013 21:17:20 +0100 Subject: [PATCH] Dont add more callbacks when disabled --- .../client/plugins/callbacks/Callbacks.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/callbacks/Callbacks.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/callbacks/Callbacks.java index a91379ab..0a34b5d5 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/callbacks/Callbacks.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/callbacks/Callbacks.java @@ -119,8 +119,7 @@ public class Callbacks { * Disable a callback list from doing anything more. */ public Callbacks disable() { - callbacks = JsObjectArray.create(); - memory = null; + callbacks = memory = null; done = true; return this; } @@ -152,13 +151,15 @@ public class Callbacks { } private void addAll(Object...o) { - for (Object c : o) { - if (!opts.getUnique() || !callbacks.contains(c)) { - callbacks.add(c); - } - // In jQuery add always is run when memory is true even when unique is set - if (opts.getMemory() && memory != null) { - run(c, memory.elements()); + if (callbacks != null) { + for (Object c : o) { + if (!opts.getUnique() || !callbacks.contains(c)) { + callbacks.add(c); + } + // In jQuery add always is run when memory is true even when unique is set + if (opts.getMemory() && memory != null) { + run(c, memory.elements()); + } } } } -- 2.39.5