mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 17:52:26 -05:00
Kernel: Fix crash when switching to console 5 & 6
The changes in commit 20743e8
removed the s_max_virtual_consoles
constant and hardcoded the number of consoles to 4. But in
PS2KeyboardDevice the keyboard shortcuts for switching to consoles were
hardcoded to 6.
I reintroduced the constant and added it in both places.
This commit is contained in:
parent
b3746f9745
commit
77044dd383
Notes:
sideshowbarker
2024-07-18 17:07:11 +09:00
Author: https://github.com/SebastianZaha 🔰 Commit: https://github.com/SerenityOS/serenity/commit/77044dd3838 Pull-request: https://github.com/SerenityOS/serenity/pull/7599
3 changed files with 4 additions and 2 deletions
|
@ -70,7 +70,7 @@ void PS2KeyboardDevice::irq_handle_byte_read(u8 byte)
|
|||
default:
|
||||
if (m_modifiers & Mod_Alt) {
|
||||
switch (ch) {
|
||||
case 0x02 ... 0x07: // 1 to 6
|
||||
case 0x02 ... 0x01 + ConsoleManagement::s_max_virtual_consoles:
|
||||
g_io_work->queue([this, ch]() {
|
||||
ConsoleManagement::the().switch_to(ch - 0x02);
|
||||
});
|
||||
|
|
|
@ -44,7 +44,7 @@ UNMAP_AFTER_INIT ConsoleManagement::ConsoleManagement()
|
|||
|
||||
UNMAP_AFTER_INIT void ConsoleManagement::initialize()
|
||||
{
|
||||
for (size_t index = 0; index < 4; index++) {
|
||||
for (size_t index = 0; index < s_max_virtual_consoles; index++) {
|
||||
// FIXME: Better determine the debug TTY we chose...
|
||||
if (index == 1) {
|
||||
m_consoles.append(VirtualConsole::create_with_preset_log(index, ConsoleDevice::the().logbuffer()));
|
||||
|
|
|
@ -20,6 +20,8 @@ class ConsoleManagement {
|
|||
public:
|
||||
ConsoleManagement();
|
||||
|
||||
static constexpr unsigned s_max_virtual_consoles = 6;
|
||||
|
||||
static bool is_initialized();
|
||||
static ConsoleManagement& the();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue