When DISABLE_MEM_POOLS is set, loop through and free the poll records
authorOwen Taylor <otaylor@redhat.com>
Mon, 25 Aug 2003 16:20:41 +0000 (16:20 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Mon, 25 Aug 2003 16:20:41 +0000 (16:20 +0000)
Mon Aug 25 12:17:20 2003  Owen Taylor  <otaylor@redhat.com>

        * glib/gmain.c (g_main_context_unref_and_unlock):
        When DISABLE_MEM_POOLS is set, loop through and free
        the poll records explicitely, since g_mem_chunk_destroy()
        won't do it. (#118121, Morten Welinder)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
glib/gmain.c

index 636afdc..ccf7305 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Mon Aug 25 12:17:20 2003  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gmain.c (g_main_context_unref_and_unlock): 
+       When DISABLE_MEM_POOLS is set, loop through and free
+       the poll records explicitely, since g_mem_chunk_destroy()
+       won't do it. (#118121, Morten Welinder)
 2003-08-22  Samúel Jón Gunnarsson  <sammi@techattack.nu>
 
        * is.po: Added "is" to ALL_LINGUAS.
index 636afdc..ccf7305 100644 (file)
@@ -1,3 +1,10 @@
+Mon Aug 25 12:17:20 2003  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gmain.c (g_main_context_unref_and_unlock): 
+       When DISABLE_MEM_POOLS is set, loop through and free
+       the poll records explicitely, since g_mem_chunk_destroy()
+       won't do it. (#118121, Morten Welinder)
 2003-08-22  Samúel Jón Gunnarsson  <sammi@techattack.nu>
 
        * is.po: Added "is" to ALL_LINGUAS.
index 636afdc..ccf7305 100644 (file)
@@ -1,3 +1,10 @@
+Mon Aug 25 12:17:20 2003  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gmain.c (g_main_context_unref_and_unlock): 
+       When DISABLE_MEM_POOLS is set, loop through and free
+       the poll records explicitely, since g_mem_chunk_destroy()
+       won't do it. (#118121, Morten Welinder)
 2003-08-22  Samúel Jón Gunnarsson  <sammi@techattack.nu>
 
        * is.po: Added "is" to ALL_LINGUAS.
index 636afdc..ccf7305 100644 (file)
@@ -1,3 +1,10 @@
+Mon Aug 25 12:17:20 2003  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gmain.c (g_main_context_unref_and_unlock): 
+       When DISABLE_MEM_POOLS is set, loop through and free
+       the poll records explicitely, since g_mem_chunk_destroy()
+       won't do it. (#118121, Morten Welinder)
 2003-08-22  Samúel Jón Gunnarsson  <sammi@techattack.nu>
 
        * is.po: Added "is" to ALL_LINGUAS.
index 636afdc..ccf7305 100644 (file)
@@ -1,3 +1,10 @@
+Mon Aug 25 12:17:20 2003  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gmain.c (g_main_context_unref_and_unlock): 
+       When DISABLE_MEM_POOLS is set, loop through and free
+       the poll records explicitely, since g_mem_chunk_destroy()
+       won't do it. (#118121, Morten Welinder)
 2003-08-22  Samúel Jón Gunnarsson  <sammi@techattack.nu>
 
        * is.po: Added "is" to ALL_LINGUAS.
index 636afdc..ccf7305 100644 (file)
@@ -1,3 +1,10 @@
+Mon Aug 25 12:17:20 2003  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gmain.c (g_main_context_unref_and_unlock): 
+       When DISABLE_MEM_POOLS is set, loop through and free
+       the poll records explicitely, since g_mem_chunk_destroy()
+       won't do it. (#118121, Morten Welinder)
 2003-08-22  Samúel Jón Gunnarsson  <sammi@techattack.nu>
 
        * is.po: Added "is" to ALL_LINGUAS.
index a3a9dc9..c838274 100644 (file)
@@ -553,6 +553,26 @@ g_main_context_ref (GMainContext *context)
   UNLOCK_CONTEXT (context);
 }
 
+/* If DISABLE_MEM_POOLS is defined, then freeing the
+ * mem chunk won't free the records, so we have to
+ * do it manually. The conditionalization here is
+ * an optimization; g_mem_chunk_free() is a no-op
+ * when DISABLE_MEM_POOLS is set.
+ */
+#ifdef DISABLE_MEM_POOLS
+static void
+poll_rec_list_free (GMainContext *context,
+                   GPollRec     *list)
+{
+  while (list)
+    {
+      GPollRec *tmp_rec = list;
+      list = list->next;
+      g_chunk_free (tmp_rec, context->poll_chunk);
+    }
+}
+#endif /* DISABLE_MEM_POOLS */
+
 static void
 g_main_context_unref_and_unlock (GMainContext *context)
 {
@@ -581,7 +601,12 @@ g_main_context_unref_and_unlock (GMainContext *context)
 
   g_ptr_array_free (context->pending_dispatches, TRUE);
   g_free (context->cached_poll_array);
+
+#ifdef DISABLE_MEM_POLLS
+  poll_rec_list_free (context, context->poll_records);
+  poll_rec_list_free (context, context->poll_free_list);
+#endif /* DISABLE_MEM_POOLS */
+  
   if (context->poll_chunk) 
     g_mem_chunk_destroy (context->poll_chunk);