Bug 543747 - [win32] JVM crash after connecting Windows Remote Desktop
Change-Id: I1adcf49f7f0383b1068b3500986d8c5a3975979b
Co-authored-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
index 6f082bf..ef3cf73 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -69,6 +69,7 @@
Region region;
Font font;
int drawCount, foreground, background, backgroundAlpha = 255;
+ long /*int*/ hPrevIMC;
/**
* Prevents uninitialized instances from being created outside the package.
@@ -722,7 +723,7 @@
}
if (OS.IsDBLocale && hwndParent != 0) {
long /*int*/ hIMC = OS.ImmGetContext (hwndParent);
- OS.ImmAssociateContext (handle, hIMC);
+ hPrevIMC = OS.ImmAssociateContext (handle, hIMC);
OS.ImmReleaseContext (hwndParent, hIMC);
}
@@ -2523,7 +2524,8 @@
void releaseWidget () {
super.releaseWidget ();
if (OS.IsDBLocale) {
- OS.ImmAssociateContext (handle, 0);
+ OS.ImmAssociateContext (handle, hPrevIMC);
+ hPrevIMC = 0;
}
if (toolTipText != null) {
setToolTipText (getShell (), null);