From 59ffe6726d6d0d2cd8350396253ce6588255be81 Mon Sep 17 00:00:00 2001 From: Amartya Parijat Date: Thu, 24 Jul 2025 10:18:04 +0200 Subject: [PATCH] Copy Region Handle in Region:copy win32 #2346 This commit fixes the regression in #2346 caused by Region:copy. The copied region handle needs to be in the right state as of the original region handle since GC:getClipping(Region) can modify the original region's handle without storing region operations. contributes to https://github.com/eclipse-platform/eclipse.platform.swt/issues/2346 --- .../Eclipse SWT/win32/org/eclipse/swt/graphics/Region.java | 4 ++++ 1 file changed, 4 insertions(+) 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 5e6fc072e3b..c0a8634fa22 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 @@ -646,6 +646,10 @@ private RegionHandle getRegionHandle(int zoom) { Region copy() { Region region = new Region(); + this.zoomToHandle.forEach((zoom, regionHandle) -> { + long handleCopy = win32_getHandle(region, zoom); + OS.CombineRgn(handleCopy, regionHandle.handle, 0, OS.RGN_COPY); + }); region.operations.addAll(operations); return region; }