mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-09-23 04:55:23 -04:00
crash: don't copy TryCatch by value
The v8.Handle is initialized / registered with v8 at that address and can't be copied.
This commit is contained in:
1 file changed
+4
-4
@@ -34,7 +34,7 @@ pub fn init(self: *TryCatch, l: *const js.Local) void {
|
|||||||
v8.v8__TryCatch__CONSTRUCT(&self.handle, l.isolate.handle);
|
v8.v8__TryCatch__CONSTRUCT(&self.handle, l.isolate.handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn hasCaught(self: TryCatch) bool {
|
pub fn hasCaught(self: *const TryCatch) bool {
|
||||||
return v8.v8__TryCatch__HasCaught(&self.handle);
|
return v8.v8__TryCatch__HasCaught(&self.handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,12 +46,12 @@ pub fn rethrow(self: *TryCatch) void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The raw caught exception value, e.g. to report it to a global's onerror.
|
// The raw caught exception value, e.g. to report it to a global's onerror.
|
||||||
pub fn exceptionValue(self: TryCatch) ?js.Value {
|
pub fn exceptionValue(self: *const TryCatch) ?js.Value {
|
||||||
const handle = v8.v8__TryCatch__Exception(&self.handle) orelse return null;
|
const handle = v8.v8__TryCatch__Exception(&self.handle) orelse return null;
|
||||||
return .{ .local = self.local, .handle = handle };
|
return .{ .local = self.local, .handle = handle };
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn caught(self: TryCatch, allocator: Allocator) ?Caught {
|
pub fn caught(self: *const TryCatch, allocator: Allocator) ?Caught {
|
||||||
if (self.hasCaught() == false) {
|
if (self.hasCaught() == false) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -107,7 +107,7 @@ pub fn caught(self: TryCatch, allocator: Allocator) ?Caught {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn caughtOrError(self: TryCatch, allocator: Allocator, err: anyerror) Caught {
|
pub fn caughtOrError(self: *const TryCatch, allocator: Allocator, err: anyerror) Caught {
|
||||||
return self.caught(allocator) orelse .{
|
return self.caught(allocator) orelse .{
|
||||||
.caught = false,
|
.caught = false,
|
||||||
.line = null,
|
.line = null,
|
||||||
|
|||||||
Reference in new issue
Block a user