Skip to content

Commit c54dd2a

Browse files
committed
Remove dispose call for Color
According to the Javadoc on Color: * Colors do not need to be disposed, however to maintain compatibility * with older code, disposing a Color is not an error.
1 parent 47ea4b0 commit c54dd2a

File tree

7 files changed

+7
-33
lines changed

7 files changed

+7
-33
lines changed

debug/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/DebugUIPlugin.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2005, 2018 IBM Corporation and others.
2+
* Copyright (c) 2005, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -16,9 +16,7 @@
1616

1717
import java.net.URL;
1818
import java.util.HashMap;
19-
import java.util.Iterator;
2019
import java.util.Map;
21-
import java.util.Map.Entry;
2220
import java.util.MissingResourceException;
2321
import java.util.ResourceBundle;
2422

@@ -118,11 +116,6 @@ public void stop(BundleContext context) throws Exception {
118116
super.stop(context);
119117
plugin = null;
120118
resourceBundle = null;
121-
Iterator<Entry<RGB, Color>> colors = fColors.entrySet().iterator();
122-
while (colors.hasNext()) {
123-
Entry<RGB, Color> entry = colors.next();
124-
entry.getValue().dispose();
125-
}
126119
}
127120

128121
/**

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ColorManager.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2013 IBM Corporation and others.
2+
* Copyright (c) 2000, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -49,11 +49,6 @@ public Color getColor(RGB rgb) {
4949
return color;
5050
}
5151

52-
public void dispose() {
53-
for (Color color : fColorTable.values()) {
54-
color.dispose();
55-
}
56-
}
5752
}
5853

5954

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2019 IBM Corporation and others.
2+
* Copyright (c) 2000, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -458,8 +458,6 @@ public void stop(BundleContext context) throws Exception {
458458
fContextLaunchingManager.shutdown();
459459
}
460460

461-
ColorManager.getDefault().dispose();
462-
463461
if (fgPresentation != null) {
464462
fgPresentation.dispose();
465463
}

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2005, 2013 IBM Corporation and others.
2+
* Copyright (c) 2005, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -166,9 +166,6 @@ public synchronized void dispose() {
166166
font.dispose();
167167
}
168168
fFontCache.clear();
169-
for (Color color : fColorCache.values()) {
170-
color.dispose();
171-
}
172169
fColorCache.clear();
173170

174171
if (fModel != null) {

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2008, 2017 IBM Corporation and others.
2+
* Copyright (c) 2008, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -96,7 +96,6 @@ protected void drawCompositeImage(int width, int height) {
9696
gc.fillPolygon(new int[] {
9797
0, 0, ARROW_SIZE, ARROW_SIZE, 0, ARROW_SIZE * 2 });
9898
gc.dispose();
99-
triangleColor.dispose();
10099

101100
ImageData imageData = image.getImageData(zoom);
102101
image.dispose();

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2006, 2018 IBM Corporation and others.
2+
* Copyright (c) 2006, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -242,9 +242,6 @@ public void dispose() {
242242
font.dispose();
243243
}
244244
fFontCache.clear();
245-
for (Color color : fColorCache.values()) {
246-
color.dispose();
247-
}
248245
fColorCache.clear();
249246
super.dispose();
250247
}

debug/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/UnitTestProgressBar.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2010 IBM Corporation and others.
2+
* Copyright (c) 2000, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -57,11 +57,6 @@ public void controlResized(ControlEvent e) {
5757
}
5858
});
5959
addPaintListener(this::paint);
60-
addDisposeListener(event -> {
61-
fFailureColor.dispose();
62-
fOKColor.dispose();
63-
fStoppedColor.dispose();
64-
});
6560
Display display = parent.getDisplay();
6661
fFailureColor = new Color(display, 159, 63, 63);
6762
fOKColor = new Color(display, 95, 191, 95);

0 commit comments

Comments
 (0)