As I understand it, there are two cases where createStyleRuler is
called, and attached as a __styleRuler expando:
 - in initParent, the expando then references a child element; I'm not
sure this creates a leak, as there's no loop here. It could easily be
changed to use an instance variable instead (just like relativeRuler in
LayoutImpl) if it happened to be an issue.

 - in attachChild, the expando then references a sibling element. It's
not clear to me whether it'd create a leak either.

IMO (and without any testing), the leak in TabLayoutPanel is caused by
the forgotten calls to onAttach and onDetach from DeckLayoutPanel's
onLoad/onUnload. All widgets using Layout make those calls, except
DeckLayoutPanel.

Then, there's the leak introduced by LayoutImplIE8#setLayer, which is
explicitly documented:
  // Potential leak: This is cleaned up in detach().
So all layout panels leak in IE (all versions) when they're never
attached to the document.

Finally, there might be another leak you didn't talk about: in
fillParentImpl, because parent.onresize is set to a local function
referencing 'elem', and 'elem' in turn references parent from its
__resizeParent expando, so: elem -(__resizeParent)-> parent
-(onresize)-> elem; not to mention the simple leak: elem.__resizeParent
== elem.parentElement (or elem.parentElement.parentElement; it looks
like the __container loop from the other bug, in ScrollImpl).
That one could be overcome by doing the "hackery" about
tagName.toLowerCase()=='body' twice: once in fillParentImpl to branch to
the hookWindowResize code path; and then in resizeRelativeToParent: in
other words, instead of computing the "resize parent" once and store it
in the __resizeParent expando, compute it each time we want it.
However, it's not clear to me when the "parent.onresize" code path could
be reached: fillParentImpl is only called from fillParent, and
fillParent is only called by RootLayoutPanel, which always attaches
itself within RootPanel.get(), which is the document.body. LayoutImpl
calls fillParent from attachChild, but LayoutImplIE6 overrides the
method and doesn't call its super implementation (i.e. it totally
replaces it). It once called it in IE7 –not IE6– though, so it might be
a leftover from the change: r8339 for reference).


http://gwt-code-reviews.appspot.com/1601804/diff/4001/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/4001/user/src/com/google/gwt/layout/client/LayoutImplIE6.java#newcode201
user/src/com/google/gwt/layout/client/LayoutImplIE6.java:201:
setPropertyElement(parent, "__styleRuler", null);
Wouldn't it break the widget if it's later re-attached? initParent is
only called when the widget is created; you'd have to recreate a
styleRuler in onAttach for re-attaching to work.

http://gwt-code-reviews.appspot.com/1601804/

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to