diff options
author | Nikita Nemkin | 2021-09-05 08:48:33 +0000 |
---|---|---|
committer | Niraj Modi | 2021-09-07 09:52:07 +0000 |
commit | 71154a71800e5ad393893e9a1a8459aeceb0e463 (patch) | |
tree | aa27f8b033ba81f8f355cdf619da5867a18cd746 | |
parent | b01adf8afae99371e096a7bf0de1bd3f348da013 (diff) | |
download | eclipse.platform.swt-71154a71800e5ad393893e9a1a8459aeceb0e463.tar.gz eclipse.platform.swt-71154a71800e5ad393893e9a1a8459aeceb0e463.tar.xz eclipse.platform.swt-71154a71800e5ad393893e9a1a8459aeceb0e463.zip |
Bug 575778 - Using Alpha transparency and Pattern leads to EXCEPTION_ACCESS_VIOLATION
The fix for Bug 121220 assumes that all patterns are Image-based,
leading to crashes when a gradient or solid color brush is passed
to TextureBrush_GetImage.
Change-Id: I2bd25e15ec29cbedda6f532414c30ea5b17abd93
Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/184985
Tested-by: Platform Bot <platform-bot@eclipse.org>
Reviewed-by: Niraj Modi <niraj.modi@in.ibm.com>
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java index cdc8f3c321..a89ddf86f9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java @@ -612,6 +612,9 @@ static long createGdipFont(long hDC, long hFont, long graphics, long fontCollect * </ul> */ static long createAlphaTextureBrush(long brush, int alpha) { + if (Gdip.Brush_GetType(brush) != Gdip.BrushTypeTextureFill) { + return Gdip.Brush_Clone(brush); + } long hatchImage = Gdip.TextureBrush_GetImage(brush); if (hatchImage == 0) SWT.error(SWT.ERROR_CANNOT_BE_ZERO); long transparentHatchImage = Gdip.Image_Clone(hatchImage); |