mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-06-12 10:06:12 -04:00
Merge pull request #2090 from lightpanda-io/rc_assertion
add assertion on RC (to catch release overflow)
This commit is contained in:
@@ -249,9 +249,7 @@ pub fn RC(comptime T: type) type {
|
||||
}
|
||||
|
||||
pub fn release(self: *@This(), value: anytype, session: *Session) void {
|
||||
if (comptime IS_DEBUG) {
|
||||
std.debug.assert(self._refs > 0);
|
||||
}
|
||||
assert(self._refs > 0, "release overflow", .{ .type = @typeName(@TypeOf(value)) });
|
||||
|
||||
const refs = self._refs - 1;
|
||||
self._refs = refs;
|
||||
|
||||
Reference in New Issue
Block a user