Bug 440300 - Embedded IE compatibility mode not updated in Registry,
after forceful termination of an SWT application(with embedded IE)
Change-Id: Ide6f0d05cf3934adb2605e990f296f554845e780
Signed-off-by: Niraj Modi <niraj.modi@in.ibm.com>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java
index a02a3c1..34133af 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java
@@ -314,7 +314,16 @@
int index = path.lastIndexOf(SEPARATOR_OS);
String executable = index != -1 ? path.substring(index + 1) : path;
final TCHAR lpValueName = new TCHAR(0, executable, true);
- if (OS.RegQueryValueEx(key[0], lpValueName, 0, null, (int[])null, null) == OS.ERROR_FILE_NOT_FOUND) {
+ /*
+ * Program name & IE version entry is added to the Windows
+ * registry and same gets deleted during the dispose cycle.
+ * There is a possibility if the SWT application crashes or
+ * is exited forcefully, which leaves the registry entry
+ * as-is and hence if entry exists, updating it next time
+ * the SWT application creates embedded IE, refer bug 440300
+ */
+ int result = OS.RegQueryValueEx(key[0], lpValueName, 0, null, (int[])null, null);
+ if (result == 0 || result == OS.ERROR_FILE_NOT_FOUND) {
if (OS.RegSetValueEx(key[0], lpValueName, 0, OS.REG_DWORD, new int[] {version}, 4) == 0) {
parent.getDisplay().addListener(SWT.Dispose, new Listener() {
public void handleEvent(Event event) {