Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Konsole
Commits
6adbc553
Commit
6adbc553
authored
Sep 07, 2022
by
Tomaz Canabrava
Browse files
Don't crash on Screen.cpp
parent
25e2a9f6
Pipeline
#228367
passed with stage
in 4 minutes and 50 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/Screen.cpp
View file @
6adbc553
...
...
@@ -11,6 +11,7 @@
#include
"config-konsole.h"
// Qt
#include
<QFile>
#include
<QTextStream>
// Konsole decoders
...
...
@@ -1657,9 +1658,31 @@ void Screen::setSelectionEnd(const int x, const int y, const bool trimTrailingWh
}
}
}
else
{
const
size_t
line
=
bottomRow
-
_history
->
getLines
();
size_t
line
=
bottomRow
-
_history
->
getLines
();
const
int
lastColumn
=
(
line
<
_lineProperties
.
size
()
&&
_lineProperties
[
line
]
&
LINE_DOUBLEWIDTH
)
?
_columns
/
2
:
_columns
;
const
auto
*
data
=
_screenLines
[
line
].
data
();
// This should never happen, but it's happening. this is just to gather some information
// about the crash.
// Do not let this code go to a release.
if
(
_screenLines
.
size
()
<
line
)
{
QFile
konsoleInfo
(
QStringLiteral
(
"~/konsole_info_crash_array_out_of_bounds.txt"
));
konsoleInfo
.
open
(
QIODevice
::
WriteOnly
);
QTextStream
messages
(
&
konsoleInfo
);
messages
<<
"_selBegin"
<<
_selBegin
<<
"
\n
"
;
messages
<<
"endPos"
<<
endPos
<<
"
\n
"
;
messages
<<
"_selBottomRight"
<<
_selBottomRight
<<
"
\n
"
;
messages
<<
"bottomRow Calculation: (_selBottomRight / _columns) = "
<<
_selBottomRight
<<
"/"
<<
_columns
<<
"
\n
"
;
messages
<<
"line Calculation: (bottomRow - _history->getLines()) = "
<<
bottomRow
<<
"-"
<<
_history
->
getLines
()
<<
"
\n
"
;
messages
<<
"_screenLines.count()"
<<
_screenLines
.
size
()
<<
"
\n
"
;
messages
<<
"line"
<<
line
<<
"
\n
"
;
}
// HACK: do not crash.
if
(
_screenLines
.
size
()
<
line
)
{
line
=
_screenLines
.
size
()
-
1
;
}
const
int
length
=
_screenLines
.
at
(
line
).
count
();
for
(
int
k
=
bottomColumn
;
k
<
lastColumn
&&
k
<
length
;
k
++
)
{
...
...
Matan Ziv-Av
@matan
mentioned in merge request
!754 (merged)
·
Oct 09, 2022
mentioned in merge request
!754 (merged)
mentioned in merge request !754
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment