6508941: java.awt.Desktop.open causes VM to crash with video files sporadically
Reviewed-by: kizune, aivanov
This commit is contained in:
parent
7c7facc234
commit
85269470e5
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -85,13 +85,24 @@ JNIEXPORT jstring JNICALL Java_sun_awt_windows_WDesktopPeer_ShellExecute
|
||||
|
||||
// 6457572: ShellExecute possibly changes FPU control word - saving it here
|
||||
unsigned oldcontrol87 = _control87(0, 0);
|
||||
HINSTANCE retval = ::ShellExecute(NULL, verb_c, fileOrUri_c, NULL, NULL, SW_SHOWNORMAL);
|
||||
DWORD error = ::GetLastError();
|
||||
HRESULT hr = ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED |
|
||||
COINIT_DISABLE_OLE1DDE);
|
||||
HINSTANCE retval;
|
||||
DWORD error;
|
||||
if (SUCCEEDED(hr)) {
|
||||
retval = ::ShellExecute(NULL, verb_c, fileOrUri_c, NULL, NULL,
|
||||
SW_SHOWNORMAL);
|
||||
error = ::GetLastError();
|
||||
::CoUninitialize();
|
||||
}
|
||||
_control87(oldcontrol87, 0xffffffff);
|
||||
|
||||
JNU_ReleaseStringPlatformChars(env, fileOrUri_j, fileOrUri_c);
|
||||
JNU_ReleaseStringPlatformChars(env, verb_j, verb_c);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return JNU_NewStringPlatform(env, L"CoInitializeEx() failed.");
|
||||
}
|
||||
if ((int)((intptr_t)retval) <= 32) {
|
||||
// ShellExecute failed.
|
||||
LPTSTR buffer = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user