[ekiga/gnome-2-26] Small memory management improvement for the runtime



commit 0c86221bf720f10384c0d73ee7dbaeefe80f6b21
Author: Julien Puydt <jpuydt src gnome org>
Date:   Thu Apr 2 20:27:25 2009 +0000

    Small memory management improvement for the runtime
    
    svn path=/trunk/; revision=7841
---
 lib/engine/framework/runtime-glib.cpp |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/lib/engine/framework/runtime-glib.cpp b/lib/engine/framework/runtime-glib.cpp
index 4b2d58f..c74c2a2 100644
--- a/lib/engine/framework/runtime-glib.cpp
+++ b/lib/engine/framework/runtime-glib.cpp
@@ -54,13 +54,19 @@ struct message
   unsigned int seconds;
 };
 
+static void
+free_message (struct message* msg)
+{
+  delete msg;
+}
+
 static gboolean
 run_later_or_back_in_main_helper (gpointer data)
 {
   struct message *msg = (struct message *)data;
 
   msg->action ();
-  delete msg;
+  free_message (msg);
 
   return FALSE;
 }
@@ -133,7 +139,8 @@ static GSourceFuncs source_funcs = {
 void
 Ekiga::Runtime::init ()
 {
-  queue = g_async_queue_new (); // here we get a ref to the queue
+  // here we get a ref to the queue, which we'll release in quit
+  queue = g_async_queue_new_full ((GDestroyNotify)free_message);
 
   struct source* source = (struct source *)g_source_new (&source_funcs,
 					  sizeof (struct source));



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