Skip to content

Commit

Permalink
Merge pull request #5679 from pkriens/master
Browse files Browse the repository at this point in the history
Strange SWT dispose problem. This seems not to be introduced by the r…
  • Loading branch information
pkriens committed Jun 1, 2023
2 parents dffd307 + 0d1e8fe commit 3d4c25f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void update(ViewerCell cell) {
cell.setStyleRanges(label.getStyleRanges());

// Get the icon from the capability namespace
Image icon = Icons.image(R5LabelFormatter.getNamespaceImagePath(cap.getNamespace()), false);
Image icon = Icons.image(R5LabelFormatter.getNamespaceImagePath(cap.getNamespace()));
cell.setImage(icon);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ public void update(ViewerCell cell) {
if (element instanceof RequirementWrapper) {
RequirementWrapper rw = (RequirementWrapper) element;

Image icon = Icons.image(R5LabelFormatter.getNamespaceImagePath(rw.requirement.getNamespace()), true);
if (icon != null)
cell.setImage(icon);
Image icon = Icons.image(R5LabelFormatter.getNamespaceImagePath(rw.requirement.getNamespace()));
cell.setImage(icon);

StyledString label = getLabel(rw.requirement);
if (rw.resolved)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void update(ViewerCell cell) {

// Get the icon from the capability namespace
icon = Icons.image(R5LabelFormatter.getNamespaceImagePath(item.getCapability()
.getNamespace()), true);
.getNamespace()));
} else if (element instanceof Requirement) {
Requirement requirement = (Requirement) element;
if (Namespace.RESOLUTION_OPTIONAL.equals(requirement.getDirectives()
Expand Down
7 changes: 5 additions & 2 deletions bndtools.core/src/org/bndtools/core/ui/icons/Icons.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,11 @@ public static Image image(String name, boolean nullIfAbsent) {

Key k = new Key(name);
synchronized (images) {
Image image = desc.createImage();
images.put(k, image);
Image image = images.get(k);
if (image == null) {
image = desc.createImage();
images.put(k, image);
}
return image;
}
}
Expand Down

0 comments on commit 3d4c25f

Please sign in to comment.