Skip to content

Commit

Permalink
[GEF] New fix for SWTException "Widget is disposed" when displaying a…
Browse files Browse the repository at this point in the history
… Tooltip

- The fix in 42f4319 caused a regression on Linux Wayland
- See #1076
- See eclipse/gef-classic#469
  • Loading branch information
Phillipus committed Sep 12, 2024
1 parent f2b0094 commit 4864d8f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
9 changes: 1 addition & 8 deletions org.eclipse.draw2d/src/org/eclipse/draw2d/PopUpHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,7 @@ protected LightweightSystem createLightweightSystem() {
* @since 2.0
*/
protected Shell createShell() {
// Phillipus changed this.
// If a workbench part is detached and a tooltip is initially displayed, when the part is re-attached
// the parent Shell is disposed which in turn disposes of the PopupHelper's Shell.
// This will lead to an SWT Error when the Shell is accessed again.
// To fix this, create the PopupHelper Shell with the Control's Display instead of its Shell.

//return new Shell(control.getShell(), shellStyle);
return new Shell(control.getDisplay(), shellStyle);
return new Shell(control.getShell(), shellStyle);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,18 @@ protected IFigure getCursorTarget() {
* @return the ToolTipHelper
*/
protected ToolTipHelper getToolTipHelper() {
if (toolTipHelper == null)
// Phillipus changed this.
// If a workbench part is detached and a tooltip is initially displayed, when the part is re-attached
// the parent Shell is disposed which in turn disposes of the PopupHelper's Shell.
// This will lead to an SWT Error when the Shell is accessed again.
// To fix this, if the ToolTipHelper's shell is disposed return a new one

//if (toolTipHelper == null)
// toolTipHelper = new ToolTipHelper(control);

if(toolTipHelper == null || toolTipHelper.getShell().isDisposed()) {
toolTipHelper = new ToolTipHelper(control);
}
return toolTipHelper;
}

Expand Down

0 comments on commit 4864d8f

Please sign in to comment.