Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
electron
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
ExcellentOSS
electron
Commits
bec027b5
Unverified
Commit
bec027b5
authored
9 months ago
by
Shelley Vohr
Browse files
Options
Downloads
Patches
Plain Diff
fix: ensure utilityProcess only emits one exit
parent
566c72cd
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
shell/browser/api/electron_api_utility_process.cc
+8
-10
8 additions, 10 deletions
shell/browser/api/electron_api_utility_process.cc
shell/browser/api/electron_api_utility_process.h
+1
-0
1 addition, 0 deletions
shell/browser/api/electron_api_utility_process.h
with
9 additions
and
10 deletions
shell/browser/api/electron_api_utility_process.cc
+
8
−
10
View file @
bec027b5
...
...
@@ -7,6 +7,7 @@
#include
<map>
#include
<utility>
#include
"base/debug/stack_trace.h"
#include
"base/files/file_util.h"
#include
"base/functional/bind.h"
#include
"base/no_destructor.h"
...
...
@@ -247,12 +248,16 @@ void UtilityProcessWrapper::OnServiceProcessLaunch(
}
void
UtilityProcessWrapper
::
HandleTermination
(
uint64_t
exit_code
)
{
// HandleTermination is called from multiple callsites,
// we need to ensure we only process it for the first callsite.
if
(
terminated_
)
return
;
terminated_
=
true
;
if
(
pid_
!=
base
::
kNullProcessId
)
GetAllUtilityProcessWrappers
().
Remove
(
pid_
);
CloseConnectorPort
();
EmitWithoutEvent
(
"exit"
,
exit_code
);
Unpin
();
}
...
...
@@ -269,7 +274,6 @@ void UtilityProcessWrapper::OnServiceProcessTerminatedNormally(
if
(
!
info
.
IsService
<
node
::
mojom
::
NodeService
>
()
||
info
.
GetProcess
().
Pid
()
!=
pid_
)
return
;
HandleTermination
(
info
.
exit_code
());
}
...
...
@@ -278,7 +282,6 @@ void UtilityProcessWrapper::OnServiceProcessCrashed(
if
(
!
info
.
IsService
<
node
::
mojom
::
NodeService
>
()
||
info
.
GetProcess
().
Pid
()
!=
pid_
)
return
;
HandleTermination
(
info
.
exit_code
());
}
...
...
@@ -292,13 +295,8 @@ void UtilityProcessWrapper::CloseConnectorPort() {
}
void
UtilityProcessWrapper
::
Shutdown
(
uint64_t
exit_code
)
{
if
(
pid_
!=
base
::
kNullProcessId
)
GetAllUtilityProcessWrappers
().
Remove
(
pid_
);
node_service_remote_
.
reset
();
CloseConnectorPort
();
// Emit 'exit' event
EmitWithoutEvent
(
"exit"
,
exit_code
);
Unpin
();
HandleTermination
(
exit_code
);
}
void
UtilityProcessWrapper
::
PostMessage
(
gin
::
Arguments
*
args
)
{
...
...
This diff is collapsed.
Click to expand it.
shell/browser/api/electron_api_utility_process.h
+
1
−
0
View file @
bec027b5
...
...
@@ -105,6 +105,7 @@ class UtilityProcessWrapper final
int
stdout_read_fd_
=
-
1
;
int
stderr_read_fd_
=
-
1
;
bool
connector_closed_
=
false
;
bool
terminated_
=
false
;
std
::
unique_ptr
<
mojo
::
Connector
>
connector_
;
blink
::
MessagePortDescriptor
host_port_
;
mojo
::
Receiver
<
node
::
mojom
::
NodeServiceClient
>
receiver_
{
this
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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