Skip to content

Commit 51b1011

Browse files
committed
Bug 575983 - Stop disposing colors in swt
Cleanup examples. Change-Id: Ied859cb9edafae8609b47a18aeff52ae3d9e4b09 Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/185563 Tested-by: Platform Bot <[email protected]> Reviewed-by: Alexander Kurtakov <[email protected]>
1 parent 71be7d1 commit 51b1011

File tree

8 files changed

+3
-45
lines changed

8 files changed

+3
-45
lines changed

examples/org.eclipse.swt.examples/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %plugin.SWTStandaloneExampleSet.name
44
Bundle-SymbolicName: org.eclipse.swt.examples; singleton:=true
5-
Bundle-Version: 3.107.0.qualifier
5+
Bundle-Version: 3.107.100.qualifier
66
Bundle-Vendor: %providerName
77
Bundle-Localization: plugin
88
Bundle-RequiredExecutionEnvironment: JavaSE-11

examples/org.eclipse.swt.examples/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
</parent>
2020
<groupId>org.eclipse.swt</groupId>
2121
<artifactId>org.eclipse.swt.examples</artifactId>
22-
<version>3.107.0-SNAPSHOT</version>
22+
<version>3.107.100-SNAPSHOT</version>
2323
<packaging>eclipse-plugin</packaging>
2424
</project>

examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CTabFolderTab.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2016 IBM Corporation and others.
2+
* Copyright (c) 2000, 2021 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
@@ -393,23 +393,16 @@ public void showList(CTabFolderEvent event) {
393393
@Override
394394
void resetColorsAndFonts () {
395395
super.resetColorsAndFonts ();
396-
Color oldColor = selectionForegroundColor;
397396
selectionForegroundColor = null;
398397
setSelectionForeground ();
399-
if (oldColor != null) oldColor.dispose();
400-
oldColor = selectionBackgroundColor;
401398
selectionBackgroundColor = null;
402399
setSelectionBackground ();
403-
if (oldColor != null) oldColor.dispose();
404400
Font oldFont = itemFont;
405401
itemFont = null;
406402
setItemFont ();
407403
if (oldFont != null) oldFont.dispose();
408-
oldColor = itemForegroundColor;
409404
itemForegroundColor = null;
410405
setItemForeground ();
411-
if (oldColor != null) oldColor.dispose();
412-
oldColor = itemBackgroundColor;
413406
itemBackgroundColor = null;
414407
setItemBackground ();
415408
}

examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/LinkTab.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,8 @@ void setLinkForeground () {
128128
@Override
129129
void resetColorsAndFonts () {
130130
super.resetColorsAndFonts ();
131-
Color oldColor = linkForegroundColor;
132131
linkForegroundColor = null;
133132
setLinkForeground ();
134-
if (oldColor != null) oldColor.dispose();
135133
}
136134

137135
@Override

examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,14 +1622,10 @@ void recreateExampleWidgets () {
16221622
* and fonts to default settings as well.
16231623
*/
16241624
void resetColorsAndFonts () {
1625-
Color oldColor = foregroundColor;
16261625
foregroundColor = null;
16271626
setExampleWidgetForeground ();
1628-
if (oldColor != null) oldColor.dispose();
1629-
oldColor = backgroundColor;
16301627
backgroundColor = null;
16311628
setExampleWidgetBackground ();
1632-
if (oldColor != null) oldColor.dispose();
16331629
Font oldFont = font;
16341630
font = null;
16351631
setExampleWidgetFont ();

examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -453,38 +453,26 @@ String getTabText () {
453453
@Override
454454
void resetColorsAndFonts () {
455455
super.resetColorsAndFonts ();
456-
Color oldColor = itemForegroundColor;
457456
itemForegroundColor = null;
458457
setItemForeground ();
459-
if (oldColor != null) oldColor.dispose();
460-
oldColor = itemBackgroundColor;
461458
itemBackgroundColor = null;
462459
setItemBackground ();
463-
if (oldColor != null) oldColor.dispose();
464460
Font oldFont = font;
465461
itemFont = null;
466462
setItemFont ();
467463
if (oldFont != null) oldFont.dispose();
468-
oldColor = cellForegroundColor;
469464
cellForegroundColor = null;
470465
setCellForeground ();
471-
if (oldColor != null) oldColor.dispose();
472-
oldColor = cellBackgroundColor;
473466
cellBackgroundColor = null;
474467
setCellBackground ();
475-
if (oldColor != null) oldColor.dispose();
476468
oldFont = font;
477469
cellFont = null;
478470
setCellFont ();
479471
if (oldFont != null) oldFont.dispose();
480-
oldColor = headerBackgroundColor;
481472
headerBackgroundColor = null;
482473
setHeaderBackground ();
483-
if (oldColor != null) oldColor.dispose();
484-
oldColor = headerForegroundColor;
485474
headerForegroundColor = null;
486475
setHeaderForeground ();
487-
if (oldColor != null) oldColor.dispose();
488476
}
489477

490478
/**

examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -579,38 +579,26 @@ void setColumnsResizable () {
579579
@Override
580580
void resetColorsAndFonts () {
581581
super.resetColorsAndFonts ();
582-
Color oldColor = itemForegroundColor;
583582
itemForegroundColor = null;
584583
setItemForeground ();
585-
if (oldColor != null) oldColor.dispose();
586-
oldColor = itemBackgroundColor;
587584
itemBackgroundColor = null;
588585
setItemBackground ();
589-
if (oldColor != null) oldColor.dispose();
590586
Font oldFont = font;
591587
itemFont = null;
592588
setItemFont ();
593589
if (oldFont != null) oldFont.dispose();
594-
oldColor = cellForegroundColor;
595590
cellForegroundColor = null;
596591
setCellForeground ();
597-
if (oldColor != null) oldColor.dispose();
598-
oldColor = cellBackgroundColor;
599592
cellBackgroundColor = null;
600593
setCellBackground ();
601-
if (oldColor != null) oldColor.dispose();
602594
oldFont = font;
603595
cellFont = null;
604596
setCellFont ();
605597
if (oldFont != null) oldFont.dispose();
606-
oldColor = headerBackgroundColor;
607598
headerBackgroundColor = null;
608599
setHeaderBackground ();
609-
if (oldColor != null) oldColor.dispose();
610-
oldColor = headerForegroundColor;
611600
headerForegroundColor = null;
612601
setHeaderForeground ();
613-
if (oldColor != null) oldColor.dispose();
614602

615603
}
616604

examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,15 +1215,10 @@ void releaseResources() {
12151215

12161216
if (textFont != null) textFont.dispose();
12171217
textFont = null;
1218-
if (textForeground != null) textForeground.dispose();
12191218
textForeground = null;
1220-
if (textBackground != null) textBackground.dispose();
12211219
textBackground = null;
1222-
if (strikeoutColor != null) strikeoutColor.dispose();
12231220
strikeoutColor = null;
1224-
if (underlineColor != null) underlineColor.dispose();
12251221
underlineColor = null;
1226-
if (borderColor != null) borderColor.dispose();
12271222
borderColor = null;
12281223

12291224
if (font != null) font.dispose();

0 commit comments

Comments
 (0)