Merge "CopyableLabel: Fix potential leak for unshown widgets"
This commit is contained in:
commit
1d947bf77c
@ -160,8 +160,12 @@ 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() {
|
||||||
|
if (hideHandler == null && swf != null && isAttached()) {
|
||||||
hideHandler =
|
hideHandler =
|
||||||
UserAgent.addDialogVisibleHandler(new DialogVisibleHandler() {
|
UserAgent.addDialogVisibleHandler(new DialogVisibleHandler() {
|
||||||
@Override
|
@Override
|
||||||
@ -174,7 +178,6 @@ public class CopyableLabel extends Composite implements HasText {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public String getText() {
|
public String getText() {
|
||||||
return text;
|
return text;
|
||||||
@ -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