From 666dea9bfdc61df4c2a41e3cdd202b13ef8ebb8c Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 24 Jun 2023 16:22:43 +0200 Subject: [PATCH] GPU apps stopping fix --- app/Gpu/NvidiaGpuControl.cs | 11 ++++++++++- app/Settings.cs | 7 +++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/Gpu/NvidiaGpuControl.cs b/app/Gpu/NvidiaGpuControl.cs index 53c9b220..5706b799 100644 --- a/app/Gpu/NvidiaGpuControl.cs +++ b/app/Gpu/NvidiaGpuControl.cs @@ -55,7 +55,16 @@ public class NvidiaGpuControl : IGpuControl try { Process[] processes = internalGpu.GetActiveApplications(); - foreach (Process process in processes) ProcessHelper.KillByProcess(process); + foreach (Process process in processes) + try + { + Logger.WriteLine("Kill:" + process.ProcessName); + ProcessHelper.KillByProcess(process); + } + catch (Exception ex) + { + Logger.WriteLine(ex.Message); + } } catch (Exception ex) { diff --git a/app/Settings.cs b/app/Settings.cs index 21104017..8d19827b 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -993,7 +993,10 @@ namespace GHelper private void ButtonStopGPU_Click(object? sender, EventArgs e) { - HardwareControl.KillGPUApps(); + if (HardwareControl.GpuControl is not null) + { + HardwareControl.GpuControl.KillGPUApps(); + } } public async void RefreshSensors(bool force = false) @@ -1615,7 +1618,7 @@ namespace GHelper if (eco < 0 && mux < 0) { isGpuSection = false; - + buttonEco.Visible = false; buttonStandard.Visible = false; buttonUltimate.Visible = false;