diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java index e136a87d87b..994b3eaeb3d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java @@ -959,6 +959,10 @@ void registerResourceWithZoomSupport(Resource resource) { resourcesWithZoomSupport.add(resource); } +void deregisterResourceWithZoomSupport(Resource resource) { + resourcesWithZoomSupport.remove(resource); +} + /** * Destroys the handles of all the resources in the resource tracker by * identifying the zoom levels which is not valid for any monitor diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java index 7d57b456a2c..3a8cbb748df 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java @@ -1187,6 +1187,7 @@ long initNative(String filename, int zoom) { @Override void destroy () { + device.deregisterResourceWithZoomSupport(this); if (memGC != null) memGC.dispose(); destroyHandle(); memGC = null; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Path.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Path.java index 7949d08a685..bcd482b549c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Path.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Path.java @@ -437,6 +437,7 @@ void cubicToInPixels(float cx1, float cy1, float cx2, float cy2, float x, float @Override void destroy() { + device.deregisterResourceWithZoomSupport(this); zoomLevelToHandle.values().forEach(Gdip::GraphicsPath_delete); zoomLevelToHandle.clear(); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Pattern.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Pattern.java index 36e9d97bef8..658eb83c6fc 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Pattern.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Pattern.java @@ -261,6 +261,7 @@ void setImageHandle(Image image, int zoom) { @Override void destroy() { + device.deregisterResourceWithZoomSupport(this); for (long handle: zoomLevelToHandle.values()) { destroyHandle(handle); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Region.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Region.java index 5219f385e52..da5cff40c3f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Region.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Region.java @@ -223,6 +223,7 @@ public boolean contains (Point pt) { @Override void destroy () { + device.deregisterResourceWithZoomSupport(this); zoomToHandle.values().forEach(handle -> OS.DeleteObject(handle)); zoomToHandle.clear(); operations.clear(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Transform.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Transform.java index c7174509209..38d3f3737a1 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Transform.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Transform.java @@ -156,6 +156,7 @@ static float[] checkTransform(float[] elements) { @Override void destroy() { + device.deregisterResourceWithZoomSupport(this); zoomLevelToHandle.values().forEach(Gdip::Matrix_delete); zoomLevelToHandle.clear(); }