[ekiga] Manage the status icon using a smart pointer in the gtk+ frontend



commit f4ce25ac8829fbf15c541ef74325225a60b6dd6d
Author: Julien Puydt <jpuydt free fr>
Date:   Wed Jun 19 17:56:42 2013 +0200

    Manage the status icon using a smart pointer in the gtk+ frontend

 lib/engine/gui/gtk-frontend/gtk-frontend.cpp |   12 ++++--------
 lib/engine/gui/gtk-frontend/gtk-frontend.h   |    2 +-
 2 files changed, 5 insertions(+), 9 deletions(-)
---
diff --git a/lib/engine/gui/gtk-frontend/gtk-frontend.cpp b/lib/engine/gui/gtk-frontend/gtk-frontend.cpp
index f4eae7e..9092306 100644
--- a/lib/engine/gui/gtk-frontend/gtk-frontend.cpp
+++ b/lib/engine/gui/gtk-frontend/gtk-frontend.cpp
@@ -91,12 +91,6 @@ GtkFrontend::GtkFrontend (Ekiga::ServiceCore & _core) : core(_core)
 
 GtkFrontend::~GtkFrontend ()
 {
-  // FIXME: we leak everything here, but the
-  // code should be reworked for a correct memory
-  // management
-
-  //if (status_icon)
-  //  g_object_unref (status_icon);
 }
 
 
@@ -127,7 +121,9 @@ void GtkFrontend::build ()
   preferences_window =
     boost::shared_ptr<GtkWidget> (preferences_window_new (core),
                                  gtk_widget_destroy);
-  status_icon = status_icon_new (core);
+  status_icon =
+    boost::shared_ptr<StatusIcon> (status_icon_new (core),
+                                  g_object_unref);
   main_window =
     boost::shared_ptr<GtkWidget> (gm_main_window_new (core),
                                 gtk_widget_destroy);
@@ -191,5 +187,5 @@ const GtkWidget *GtkFrontend::get_chat_window () const
 
 const StatusIcon *GtkFrontend::get_status_icon () const
 {
-  return status_icon;
+  return status_icon.get ();
 }
diff --git a/lib/engine/gui/gtk-frontend/gtk-frontend.h b/lib/engine/gui/gtk-frontend/gtk-frontend.h
index 018eff7..8543de8 100644
--- a/lib/engine/gui/gtk-frontend/gtk-frontend.h
+++ b/lib/engine/gui/gtk-frontend/gtk-frontend.h
@@ -88,7 +88,7 @@ private :
   boost::shared_ptr<GtkWidget> accounts_window;
   boost::shared_ptr<GtkWidget> call_window;
   boost::shared_ptr<GtkWidget> chat_window;
-  StatusIcon *status_icon;
+  boost::shared_ptr<StatusIcon> status_icon;
 
   Ekiga::ServiceCore & core;
 };


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