Skip to content

Commit 93713f2

Browse files
author
Ben Grant
committed
Fix crash in ProcessIdentifier
1 parent 8d71a20 commit 93713f2

File tree

3 files changed

+3
-16
lines changed

3 files changed

+3
-16
lines changed

src/bun.js/bindings/ProcessIdentifier.cpp

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,12 @@
3131
namespace WebCore {
3232
namespace Process {
3333

34-
static std::optional<ProcessIdentifier> globalIdentifier;
35-
36-
void setIdentifier(ProcessIdentifier processIdentifier)
37-
{
38-
ASSERT(isUIThread());
39-
globalIdentifier = processIdentifier;
40-
}
34+
// Bun only has 1 process
35+
static ProcessIdentifier globalIdentifier { 1 };
4136

4237
ProcessIdentifier identifier()
4338
{
44-
static std::once_flag onceFlag;
45-
std::call_once(onceFlag, [] {
46-
if (!globalIdentifier)
47-
globalIdentifier = ProcessIdentifier::generate();
48-
});
49-
50-
return *globalIdentifier;
39+
return globalIdentifier;
5140
}
5241

5342
} // namespace ProcessIdent

src/bun.js/bindings/ProcessIdentifier.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ using ProcessIdentifier = ObjectIdentifier<ProcessIdentifierType>;
3434

3535
namespace Process {
3636

37-
WEBCORE_EXPORT void setIdentifier(ProcessIdentifier);
3837
WEBCORE_EXPORT ProcessIdentifier identifier();
3938

4039
} // namespace Process

src/bun.js/bindings/ZigGlobalObject.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@
143143
#include "Performance.h"
144144
#include "ProcessBindingConstants.h"
145145
#include "ProcessBindingTTYWrap.h"
146-
#include "ProcessIdentifier.h"
147146
#include "ReadableStream.h"
148147
#include "SerializedScriptValue.h"
149148
#include "StructuredClone.h"

0 commit comments

Comments
 (0)