Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jdk17u
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
einsteinathome
openjdk
jdk17u
Commits
0cfee92c
Commit
0cfee92c
authored
11 months ago
by
Martin Doerr
Browse files
Options
Downloads
Patches
Plain Diff
8294699: Launcher causes lingering busy cursor
Backport-of: d3df3eb5d7f5537ade917db7a36caba028f94111
parent
f4da0e7a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/jdk.jpackage/windows/native/applauncher/WinLauncher.cpp
+78
-2
78 additions, 2 deletions
src/jdk.jpackage/windows/native/applauncher/WinLauncher.cpp
with
78 additions
and
2 deletions
src/jdk.jpackage/windows/native/applauncher/WinLauncher.cpp
+
78
−
2
View file @
0cfee92c
/*
* Copyright (c) 2020, 202
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 202
3
, 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
...
...
@@ -134,6 +134,82 @@ tstring getJvmLibPath(const Jvm& jvm) {
}
class
RunExecutorWithMsgLoop
{
public:
static
DWORD
apply
(
const
Executor
&
exec
)
{
RunExecutorWithMsgLoop
instance
(
exec
);
UniqueHandle
threadHandle
=
UniqueHandle
(
CreateThread
(
NULL
,
0
,
worker
,
static_cast
<
LPVOID
>
(
&
instance
),
0
,
NULL
));
if
(
threadHandle
.
get
()
==
NULL
)
{
JP_THROW
(
SysError
(
"CreateThread() failed"
,
CreateThread
));
}
MSG
msg
;
BOOL
bRet
;
while
((
bRet
=
GetMessage
(
&
msg
,
instance
.
hwnd
,
0
,
0
))
!=
0
)
{
if
(
bRet
==
-
1
)
{
JP_THROW
(
SysError
(
"GetMessage() failed"
,
GetMessage
));
}
else
{
TranslateMessage
(
&
msg
);
DispatchMessage
(
&
msg
);
}
}
// Wait for worker thread to terminate to guarantee it will not linger
// around after the thread running a message loop terminates.
const
DWORD
res
=
::
WaitForSingleObject
(
threadHandle
.
get
(),
INFINITE
);
if
(
WAIT_FAILED
==
res
)
{
JP_THROW
(
SysError
(
"WaitForSingleObject() failed"
,
WaitForSingleObject
));
}
LOG_TRACE
(
tstrings
::
any
()
<<
"Executor worker thread terminated. Exit code="
<<
instance
.
exitCode
);
return
instance
.
exitCode
;
}
private
:
RunExecutorWithMsgLoop
(
const
Executor
&
v
)
:
exec
(
v
)
{
exitCode
=
1
;
// Message-only window.
hwnd
=
CreateWindowEx
(
0
,
_T
(
"STATIC"
),
_T
(
""
),
0
,
0
,
0
,
0
,
0
,
HWND_MESSAGE
,
NULL
,
GetModuleHandle
(
NULL
),
NULL
);
if
(
!
hwnd
)
{
JP_THROW
(
SysError
(
"CreateWindowEx() failed"
,
CreateWindowEx
));
}
}
static
DWORD
WINAPI
worker
(
LPVOID
param
)
{
static_cast
<
RunExecutorWithMsgLoop
*>
(
param
)
->
run
();
return
0
;
}
void
run
()
{
JP_TRY
;
exitCode
=
static_cast
<
DWORD
>
(
exec
.
execAndWaitForExit
());
JP_CATCH_ALL
;
JP_TRY
;
if
(
!
PostMessage
(
hwnd
,
WM_QUIT
,
0
,
0
))
{
JP_THROW
(
SysError
(
"PostMessage(WM_QUIT) failed"
,
PostMessage
));
}
return
;
JP_CATCH_ALL
;
// All went wrong, PostMessage() failed. Just terminate with error code.
exit
(
1
);
}
private
:
const
Executor
&
exec
;
DWORD
exitCode
;
HWND
hwnd
;
};
void
launchApp
()
{
// [RT-31061] otherwise UI can be left in back of other windows.
::
AllowSetForegroundWindow
(
ASFW_ANY
);
...
...
@@ -180,7 +256,7 @@ void launchApp() {
exec
.
arg
(
arg
);
});
DWORD
exitCode
=
static_cast
<
DWORD
>
(
exec
.
execAndWaitForExit
()
);
DWORD
exitCode
=
RunExecutorWithMsgLoop
::
apply
(
exec
);
exit
(
exitCode
);
return
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment