From dd36034a86cc204df7a09631cd5969c8f56bca49 Mon Sep 17 00:00:00 2001
From: Meixner <andre.meixner@kit.edu>
Date: Thu, 12 Sep 2024 13:38:31 +0200
Subject: [PATCH] Disabling auto update in skill memory gui if ice connection
 error

---
 source/RobotAPI/libraries/skills_gui/SkillMemoryGui.cpp      | 5 +++++
 .../libraries/skills_gui/memory/SkillManagerWrapper.cpp      | 2 ++
 .../libraries/skills_gui/memory/SkillManagerWrapper.h        | 1 +
 3 files changed, 8 insertions(+)

diff --git a/source/RobotAPI/libraries/skills_gui/SkillMemoryGui.cpp b/source/RobotAPI/libraries/skills_gui/SkillMemoryGui.cpp
index ac0cfaa24..fb6f6e166 100644
--- a/source/RobotAPI/libraries/skills_gui/SkillMemoryGui.cpp
+++ b/source/RobotAPI/libraries/skills_gui/SkillMemoryGui.cpp
@@ -136,5 +136,10 @@ namespace armarx::skills::gui
                 &SkillManagerWrapper::connectionUpdate,
                 connectionStatusLabel,
                 &StatusLabel::handleMessage);
+
+        connect(memory.get(),
+                &SkillManagerWrapper::disableAutoUpdate,
+                updateWidget,
+                &PeriodicUpdateWidget::disableAutoUpdate);
     }
 } // namespace armarx::skills::gui
diff --git a/source/RobotAPI/libraries/skills_gui/memory/SkillManagerWrapper.cpp b/source/RobotAPI/libraries/skills_gui/memory/SkillManagerWrapper.cpp
index d19f45df5..629bdd39b 100644
--- a/source/RobotAPI/libraries/skills_gui/memory/SkillManagerWrapper.cpp
+++ b/source/RobotAPI/libraries/skills_gui/memory/SkillManagerWrapper.cpp
@@ -45,6 +45,7 @@ namespace armarx::skills::gui
                 << "Unhandled Ice exception encountered while updating executions. Exception was: "
                 << e;
             emit connectionUpdate("Could not fetch executions", e.what());
+            emit disableAutoUpdate();
             return {};
         }
         catch (...)
@@ -159,6 +160,7 @@ namespace armarx::skills::gui
                 << "Unhandled Ice exception encountered while updating skills. Exception was: "
                 << e;
             emit connectionUpdate("Could not fetch skills", e.what());
+            emit disableAutoUpdate();
             return {};
         }
         catch (...)
diff --git a/source/RobotAPI/libraries/skills_gui/memory/SkillManagerWrapper.h b/source/RobotAPI/libraries/skills_gui/memory/SkillManagerWrapper.h
index e191e1f96..db38c8a4f 100644
--- a/source/RobotAPI/libraries/skills_gui/memory/SkillManagerWrapper.h
+++ b/source/RobotAPI/libraries/skills_gui/memory/SkillManagerWrapper.h
@@ -79,6 +79,7 @@ namespace armarx::skills::gui
         };
 
     signals:
+        void disableAutoUpdate();
         void connectionUpdate(std::string const& message, std::string const& error);
         void updateAvailable(Snapshot update);
         void searchAccepted();
-- 
GitLab