Page 1 of 1

[1.1.91] Crashes when focused while switching video output

Posted: Mon Oct 02, 2023 5:49 am
by Henriquelay
I use a KVM, and when I switch (video, HID including audio) when the game is focused, it crashes to desktop.
When the game is not focused, it does not crash.
Steps to reproduce
  1. Load up game
  2. Have it focused on your WM
  3. At any time, switch the KVM to other device
  4. Come back to Factorio device
  5. It has crashed
If step 2 is not realized, the game does not crash.

It is unclear if it crashed when switching out or switching in, but apparently on a quick read of the log, I would guess it is the former, since there is
SDL coudn't be initialized. SDL_Error: No available displays
Expected behavior
The game keeps running on my headless machine. Either "paused" or normally running without visuals.
My Setup
Steam download, 1.1.91, build 61680, linux64
Arch Linux, Sway, AMD Video card with AMDGPU-PRO (proprietary) drivers, single monitor connected on KVM through Displayport 1.2.

The logfile provided has mods applied but the crashes occur regardless of mods' presence. I haven't tried to replicate in Windows.

Re: [1.1.91] Crashes when focused while switching video output

Posted: Wed Mar 20, 2024 6:24 pm
by raiguard
Thanks for the report. This specific crash is happening because SDL expects a display to exist when initializing the graphics subsystem. I don't think there's a good way to fix that. If you wait until the game window appears before switching your KVM then it should continue to work. At least, it did in my limited testing.