[gnome-builder] libidemm: disconnect signal on unload plugin



commit 0f02f0f594bda06af41c8c68efa42eb18ce7eb3b
Author: Marcin Kolny <marcin kolny gmail com>
Date:   Fri Apr 8 21:06:15 2016 +0200

    libidemm: disconnect signal on unload plugin

 plugins/hello-cpp/hellocppapplicationaddin.cc |    5 +++--
 plugins/hello-cpp/hellocppapplicationaddin.h  |    3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/plugins/hello-cpp/hellocppapplicationaddin.cc b/plugins/hello-cpp/hellocppapplicationaddin.cc
index 84746fe..ba44617 100644
--- a/plugins/hello-cpp/hellocppapplicationaddin.cc
+++ b/plugins/hello-cpp/hellocppapplicationaddin.cc
@@ -42,7 +42,7 @@ HelloCppApplicationAddin::HelloCppApplicationAddin(GObject *gobj)
 {
   using namespace std::chrono;
 
-  application->signal_shutdown().connect([this] {
+  con = application->signal_shutdown().connect([this] {
       auto stop = steady_clock::now();
       auto elapsed_seconds = duration_cast<seconds>(stop - start).count();
       char message [100];
@@ -55,7 +55,8 @@ HelloCppApplicationAddin::HelloCppApplicationAddin(GObject *gobj)
 
   void HelloCppApplicationAddin::unload_vfunc(const Glib::RefPtr<Ide::Application>& application)
 {
-  std::cout << "Unloading application" << std::endl;
+  std::cout << "Unloading example C++ addin" << std::endl;
+  con.disconnect();
 }
 
 }
diff --git a/plugins/hello-cpp/hellocppapplicationaddin.h b/plugins/hello-cpp/hellocppapplicationaddin.h
index 992f14a..8fb300c 100644
--- a/plugins/hello-cpp/hellocppapplicationaddin.h
+++ b/plugins/hello-cpp/hellocppapplicationaddin.h
@@ -30,7 +30,8 @@ class HelloCppApplicationAddin : public Glib::Object, public Ide::ApplicationAdd
 {
 private:
   std::chrono::time_point<std::chrono::steady_clock> start;
-
+  sigc::connection con;
+  
 public:
   typedef GObject BaseObjectType;
   typedef Glib::Object_Class CppClassType;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]