Skip to content

Commit

Permalink
userportal, webadmin: work around GWT-P memory leak
Browse files Browse the repository at this point in the history
We encountered a fairly large memory leak in the latest
version of GWT-P. All GWT-P popups have a resize handler
attached to them, but this handler lives at window scope
and never lets go. Therefore, every popup is completely
leaked when closed.

However, luckily, the method in GWT-P that sets up this
handler has a hook/template method for disabling the addition
of the handler:
    if (repositionOnWindowResize()) {
         Window.addResizeHandler(new ResizeHandler() ...

We simply overload repositionOnWindowResize() to always
return false and the leak is worked around.

See: ArcBees/GWTP#823

Change-Id: I4e6d4da68e3f50f5863f4e33e62581b97e36dd2d
Signed-off-by: Greg Sheremeta <gshereme@redhat.com>
  • Loading branch information
gregsheremeta authored and vojtechszocs committed Jun 14, 2017
1 parent 75fb325 commit 65646fc
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ protected final void initWidget(IsWidget widget) {
throw new IllegalArgumentException("Use initWidget(PopupPanel) instead of initWidget(Widget)"); //$NON-NLS-1$
}

/**
* Return false to work around GWT-P memory leak. The resize handler implementation is broken,
* so turn it off
* See: https://github.com/ArcBees/GWTP/issues/823
*/
@Override
protected boolean repositionOnWindowResize() {
return false;
}

protected void initWidget(T widget) {
super.initWidget(widget);

Expand Down

0 comments on commit 65646fc

Please sign in to comment.