Skip to content

Commit

Permalink
fix: Spamming debug logs while resizing (#331)
Browse files Browse the repository at this point in the history
The session id of Screen object might not be initialized when resized.

Issue: linuxdeepin/developer-center#6296
Log: Spamming debug logs while resizing

Signed-off-by: Yutao Meng <[email protected]>
  • Loading branch information
ArchieMeng authored Jan 25, 2024
1 parent a7ebec0 commit da0ce50
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion 3rdparty/terminalwidget/lib/Screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ Screen::Screen(int l, int c)
, _lastPos(-1)
, _lastDrawnChar(0)
, _escapeSequenceUrlExtractor(new EscapeSequenceUrlExtractor)
, _sessionId(0)

{
_escapeSequenceUrlExtractor->setScreen(this);
Expand Down Expand Up @@ -380,7 +381,7 @@ void Screen::resizeImage(int new_lines, int new_columns)
if (_currentTerminalDisplay) {
// The 'zsh' works different from other shells when writting the command line.
// It needs to identify the 'zsh' and calculate the new command line.
auto currSession = SessionManager::instance()->idToSession(_sessionId);
auto currSession = _sessionId > 0 ? SessionManager::instance()->idToSession(_sessionId) : nullptr;
if (currSession
&& (QLatin1String("zsh") == currSession->foregroundProcessName())
&& (cursorLine > 0)
Expand Down

0 comments on commit da0ce50

Please sign in to comment.