Skip to content

Commit

Permalink
fix: Spamming debug logs while resizing
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 <mengyutao@deepin.org>
  • Loading branch information
ArchieMeng committed Jan 24, 2024
1 parent a7ebec0 commit 77775d0
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 77775d0

Please sign in to comment.