Skip to content
This repository has been archived by the owner before Nov 9, 2022. It is now read-only.
Permalink
Browse files
6508941: java.awt.Desktop.open causes VM to crash with video files sp…
…oradically

Reviewed-by: kizune, aivanov
  • Loading branch information
mrserb committed Dec 3, 2020
1 parent 7c7facc commit 85269470e530f820f9190ae799c459c6f65104c6
Showing 1 changed file with 14 additions and 3 deletions.
@@ -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;

0 comments on commit 8526947

Please sign in to comment.