Skip to content

Commit be608ea

Browse files
authored
renderer: don't allow the scrollbar state to block the renderer (#9270)
This fixes the source of a deadlock that some tip users have hit. If our surface mailbox is full and there is a dirty scrollbar state, then drawFrame would block forever trying to queue to the surface mailbox. We now fail instantly if the queue is full and keep the scrollbar state dirty. We can try again on the next frame, it's not a critical thing to get updated.
2 parents be0da48 + 3a9eedc commit be608ea

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/renderer/generic.zig

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,10 +1322,11 @@ pub fn Renderer(comptime GraphicsAPI: type) type {
13221322
// After the graphics API is complete (so we defer) we want to
13231323
// update our scrollbar state.
13241324
defer if (self.scrollbar_dirty) {
1325-
self.scrollbar_dirty = false;
1326-
_ = self.surface_mailbox.push(.{
1325+
// Fail instantly if the surface mailbox if full, we'll just
1326+
// get it on the next frame.
1327+
if (self.surface_mailbox.push(.{
13271328
.scrollbar = self.scrollbar,
1328-
}, .{ .forever = {} });
1329+
}, .instant) > 0) self.scrollbar_dirty = false;
13291330
};
13301331

13311332
// Let our graphics API do any bookkeeping, etc.

0 commit comments

Comments
 (0)