From db57a7853b8726c4db7130521ee6ccb423878923 Mon Sep 17 00:00:00 2001
From: Daniele Forsi <iu5hkx@gmail.com>
Date: Wed, 22 May 2024 23:32:13 +0200
Subject: [PATCH] Fix crash when quitting sdrangel when the SID window is open

Fixes a stack exhaustion that happens in some machines/compiler combinations.
Fixes #2119
---
 plugins/feature/sid/sidgui.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/plugins/feature/sid/sidgui.cpp b/plugins/feature/sid/sidgui.cpp
index 7627e7a35..eb49eeb13 100644
--- a/plugins/feature/sid/sidgui.cpp
+++ b/plugins/feature/sid/sidgui.cpp
@@ -292,7 +292,11 @@ SIDGUI::~SIDGUI()
     clearFromMap();
 
     delete m_goesXRay;
-    delete m_solarDynamicsObservatory;
+    if (m_solarDynamicsObservatory)
+    {
+        delete m_player;
+        delete m_solarDynamicsObservatory;
+    }
     delete ui;
 }