Note that this is just a first pass because technically __styleRule is set in initParent, not onAttach.
That means if a user merely instantiates a widget that uses Layout, but doesn't attach/detach it, this __styleRuler cleanup won't be run, so the leak will still happen. Instead, the __styleRuler expando should, I think, only be set in onAttach, so then we can be sure it will be unset in onDetach. Off the top of my head, I was thinking of changing "initParent" to assign the createStyleRuler(parent) result to a field (instead of directly to the expando), and then only once onAttach is called, __styleRuler to the field value. There could be a more elegant solution I'm missing here, but I think that would do it. Any suggestions? http://gwt-code-reviews.appspot.com/1601804/diff/1/user/src/com/google/gwt/layout/client/LayoutImplIE6.java File user/src/com/google/gwt/layout/client/LayoutImplIE6.java (right): http://gwt-code-reviews.appspot.com/1601804/diff/1/user/src/com/google/gwt/layout/client/LayoutImplIE6.java#newcode52 user/src/com/google/gwt/layout/client/LayoutImplIE6.java:52: // up that parent.__styleRuler = styleRuler && parent.appendChild(styleRule)) I'll delete the comment from the final patch; it's just for explaining this issue. http://gwt-code-reviews.appspot.com/1601804/diff/1/user/src/com/google/gwt/layout/client/LayoutImplIE6.java#newcode186 user/src/com/google/gwt/layout/client/LayoutImplIE6.java:186: setPropertyElement(parent, "__styleRuler", null); Will also remove the dummy comment. http://gwt-code-reviews.appspot.com/1601804/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
