renderer: don't allow the scrollbar state to block the renderer

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.
pull/9270/head
Mitchell Hashimoto 2025-10-18 21:28:47 -07:00
parent dffa4f4fc7
commit 3a9eedcd15
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
1 changed files with 4 additions and 3 deletions

View File

@ -1322,10 +1322,11 @@ pub fn Renderer(comptime GraphicsAPI: type) type {
// After the graphics API is complete (so we defer) we want to
// update our scrollbar state.
defer if (self.scrollbar_dirty) {
self.scrollbar_dirty = false;
_ = self.surface_mailbox.push(.{
// Fail instantly if the surface mailbox if full, we'll just
// get it on the next frame.
if (self.surface_mailbox.push(.{
.scrollbar = self.scrollbar,
}, .{ .forever = {} });
}, .instant) > 0) self.scrollbar_dirty = false;
};
// Let our graphics API do any bookkeeping, etc.