mangohud: fix crash (#381984)
This commit is contained in:
@@ -128,6 +128,11 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
libdbus = dbus.lib;
|
||||
inherit hwdata;
|
||||
})
|
||||
|
||||
# Fix crash when starting hidden
|
||||
# Upstream PR: https://github.com/flightlessmango/MangoHud/pull/1570
|
||||
# FIXME: remove when merged
|
||||
./fix-crash.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
From f0d7e4f4b2d362d90bb81d0b10ef5c505b9661ea Mon Sep 17 00:00:00 2001
|
||||
From: K900 <me@0upti.me>
|
||||
Date: Fri, 14 Feb 2025 11:41:09 +0300
|
||||
Subject: [PATCH] mangoapp: don't crash if gpus is not initialized yet
|
||||
|
||||
This seems to happen on startup on Steam Deck style gamescope-session setups.
|
||||
Just check for gpus = null before trying to access it.
|
||||
---
|
||||
src/app/main.cpp | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/app/main.cpp b/src/app/main.cpp
|
||||
index 0c7c13e07e..4d1d3b1277 100644
|
||||
--- a/src/app/main.cpp
|
||||
+++ b/src/app/main.cpp
|
||||
@@ -369,8 +369,9 @@ int main(int, char**)
|
||||
XSync(x11_display, 0);
|
||||
mangoapp_paused = false;
|
||||
// resume all GPU threads
|
||||
- for (auto gpu : gpus->available_gpus)
|
||||
- gpu->resume();
|
||||
+ if (gpus)
|
||||
+ for (auto gpu : gpus->available_gpus)
|
||||
+ gpu->resume();
|
||||
}
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(mangoapp_m);
|
||||
@@ -409,8 +410,9 @@ int main(int, char**)
|
||||
XSync(x11_display, 0);
|
||||
mangoapp_paused = true;
|
||||
// pause all GPUs threads
|
||||
- for (auto gpu : gpus->available_gpus)
|
||||
- gpu->pause();
|
||||
+ if (gpus)
|
||||
+ for (auto gpu : gpus->available_gpus)
|
||||
+ gpu->pause();
|
||||
|
||||
// If mangoapp is hidden, using mangoapp_cv.wait() causes a hang.
|
||||
// Because of this hang, we can't detect if the user presses R_SHIFT + F12,
|
||||
|
||||
Reference in New Issue
Block a user