Revision: 6982 Author: b...@google.com Date: Wed Nov 18 07:47:46 2009 Log: Fix XHR memory leak one more time by re-using a static null function.
Patch by: bobv Review by: jgw http://code.google.com/p/google-web-toolkit/source/detail?r=6982 Modified: /trunk/user/src/com/google/gwt/xhr/client/XMLHttpRequest.java ======================================= --- /trunk/user/src/com/google/gwt/xhr/client/XMLHttpRequest.java Mon Nov 16 12:36:36 2009 +++ /trunk/user/src/com/google/gwt/xhr/client/XMLHttpRequest.java Wed Nov 18 07:47:46 2009 @@ -75,6 +75,13 @@ */ public static final int DONE = 4; + /** + * This is used to clear the onReadyStateChange handler. It is used by + * {...@link #clearOnReadyStateChange()}. + */ + @SuppressWarnings("unused") + private static final JavaScriptObject NULL_FUNCTION = JavaScriptObject.createFunction(); + /** * Creates an XMLHttpRequest object. * @@ -113,7 +120,7 @@ public final native void clearOnReadyStateChange() /*-{ var self = this; $wnd.setTimeout(function() { - self.onreadystatechange = function(){}; + self.onreadystatechange = @com.google.gwt.xhr.client.XMLHttpRequest::NULL_FUNCTION; }, 0); }-*/; -- http://groups.google.com/group/Google-Web-Toolkit-Contributors