Merge "CopyableLabel: Fix potential leak for unshown widgets"
This commit is contained in:
commit
1d947bf77c
@ -160,19 +160,22 @@ public class CopyableLabel extends Composite implements HasText {
|
|||||||
DOM.removeChild(getElement(), swf);
|
DOM.removeChild(getElement(), swf);
|
||||||
}
|
}
|
||||||
DOM.appendChild(getElement(), swf = SafeHtml.parse(h));
|
DOM.appendChild(getElement(), swf = SafeHtml.parse(h));
|
||||||
|
initHideHandler();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (hideHandler == null) {
|
private void initHideHandler() {
|
||||||
hideHandler =
|
if (hideHandler == null && swf != null && isAttached()) {
|
||||||
UserAgent.addDialogVisibleHandler(new DialogVisibleHandler() {
|
hideHandler =
|
||||||
@Override
|
UserAgent.addDialogVisibleHandler(new DialogVisibleHandler() {
|
||||||
public void onDialogVisible(DialogVisibleEvent event) {
|
@Override
|
||||||
swf.getStyle().setVisibility(
|
public void onDialogVisible(DialogVisibleEvent event) {
|
||||||
event.isVisible()
|
swf.getStyle().setVisibility(
|
||||||
? Style.Visibility.HIDDEN
|
event.isVisible()
|
||||||
: Style.Visibility.VISIBLE);
|
? Style.Visibility.HIDDEN
|
||||||
}
|
: Style.Visibility.VISIBLE);
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +198,12 @@ public class CopyableLabel extends Composite implements HasText {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUnload() {
|
protected void onLoad() {
|
||||||
|
initHideHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onUnload() {
|
||||||
if (hideHandler != null) {
|
if (hideHandler != null) {
|
||||||
hideHandler.removeHandler();
|
hideHandler.removeHandler();
|
||||||
hideHandler = null;
|
hideHandler = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user