From adfb9e8946ecfc08f923b0f1ad84bd2efc4f3045 Mon Sep 17 00:00:00 2001
From: Gabriel Studer <gabriel.studer@unibas.ch>
Date: Wed, 30 Jan 2019 18:39:29 +0100
Subject: [PATCH] Check whether there is already an instance of the gosty app
 around

---
 modules/gui/src/gosty_app.cc | 4 ++++
 modules/gui/src/gosty_app.hh | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/modules/gui/src/gosty_app.cc b/modules/gui/src/gosty_app.cc
index 949c76491..ec2a6b14c 100644
--- a/modules/gui/src/gosty_app.cc
+++ b/modules/gui/src/gosty_app.cc
@@ -66,6 +66,10 @@ GostyApp* GostyApp::Instance() {
   return GostyApp::app_;
 }
 
+bool GostyApp::ValidInstance() {
+  return GostyApp::app_ != NULL;
+}
+
 void GostyApp::SetAppTitle(const QString& app_title)
 {
   main_->setWindowTitle(app_title);
diff --git a/modules/gui/src/gosty_app.hh b/modules/gui/src/gosty_app.hh
index 47b0f23fa..5398c01c8 100644
--- a/modules/gui/src/gosty_app.hh
+++ b/modules/gui/src/gosty_app.hh
@@ -157,6 +157,11 @@ public:
   /// \return the GostyApp instance
   static GostyApp* Instance();
 
+  /// \brief 
+  /// GostyApp is implemented as Singleton. This returns whether there is 
+  /// already a valid instance around
+  static bool ValidInstance();
+
   /// \brief This methods sets the Title of this Application
   /// \param app_title Title that will be displayed in the title bar
   void SetAppTitle(const QString& app_title);
-- 
GitLab