From: Manuel Carrasco MoƱino Date: Wed, 27 Feb 2013 20:17:20 +0000 (+0100) Subject: Dont add more callbacks when disabled X-Git-Tag: release-1.3.2~6 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7bd17cc570088b25941d3862dfd95906a120d822;p=gwtquery.git Dont add more callbacks when disabled --- 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()); + } } } }