Skip to content

Commit 134bef1

Browse files
Resource Leak Fix
1 parent 15f9c8c commit 134bef1

File tree

1 file changed

+12
-1
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics

1 file changed

+12
-1
lines changed

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ public final class Image extends Resource implements Drawable {
9090
*/
9191
public int type;
9292

93+
/**
94+
* this field make sure the image is initialized without any errors
95+
*/
96+
boolean isInitialized = false;
97+
9398
/**
9499
* specifies the transparent pixel
95100
*/
@@ -648,6 +653,12 @@ private ImageData adaptImageDataIfDisabledOrGray(ImageData data) {
648653
return returnImageData;
649654
}
650655

656+
@Override
657+
void init() {
658+
super.init();
659+
this.isInitialized = true;
660+
}
661+
651662
private ImageData applyDisableImageData(ImageData data, int height, int width) {
652663
PaletteData palette = data.palette;
653664
RGB[] rgbs = new RGB[3];
@@ -1905,7 +1916,7 @@ private abstract class AbstractImageProviderWrapper {
19051916
abstract AbstractImageProviderWrapper createCopy(Image image);
19061917

19071918
protected boolean isDisposed() {
1908-
return isDestroyed;
1919+
return isInitialized && isDestroyed;
19091920
}
19101921

19111922
protected void destroy() {

0 commit comments

Comments
 (0)