this repo has no description
13
fork

Configure Feed

Select the types of activity you want to include in your feed.

widgets(terminal): prevent deadlock in draw

The draw method could obtain a lock but never free it due to the logic
of the if statement.

+5 -2
+5 -2
src/widgets/terminal/Terminal.zig
··· 166 166 } 167 167 168 168 pub fn draw(self: *Terminal, win: vaxis.Window) !void { 169 - if (self.back_mutex.tryLock() and !self.mode.sync) { 169 + if (self.back_mutex.tryLock()) { 170 170 defer self.back_mutex.unlock(); 171 - try self.back_screen.copyTo(&self.front_screen); 171 + // We keep this as a separate condition so we don't deadlock by obtaining the lock but not 172 + // having sync 173 + if (!self.mode.sync) 174 + try self.back_screen.copyTo(&self.front_screen); 172 175 } 173 176 174 177 var row: usize = 0;