fixed bug: deadlock when resizing PTY window

This commit is contained in:
Christian Burger 2022-04-29 16:36:07 +02:00
parent 78672521c4
commit 02266dfb0c

View file

@ -258,17 +258,20 @@ namespace krikkel::NCursesPtyWindow
/// resizing? /// resizing?
int PtyWindow::wresize(int rows, int cols) int PtyWindow::wresize(int rows, int cols)
{ {
lock_guard nCursesLock(*writeToNCursesMutex);
lock_guard writeLock(writeToPseudoTerminalMutex);
winsize windowSize =
{ {
.ws_row = narrow<unsigned short>(rows) lock_guard writeLock(writeToPseudoTerminalMutex);
, .ws_col = narrow<unsigned short>(cols) winsize windowSize =
}; {
ioctl(fdPtyHost, TIOCSWINSZ, &windowSize); .ws_row = narrow<unsigned short>(rows)
vterm_set_size(pseudoTerminal, rows, cols); , .ws_col = narrow<unsigned short>(cols)
};
return NCursesWindow::wresize(rows, cols); ioctl(fdPtyHost, TIOCSWINSZ, &windowSize);
vterm_set_size(pseudoTerminal, rows, cols);
}
{
lock_guard nCursesLock(*writeToNCursesMutex);
return NCursesWindow::wresize(rows, cols);
}
} }
int PtyWindow::staticHandlerDamage(VTermRect rect, void *user) int PtyWindow::staticHandlerDamage(VTermRect rect, void *user)