When DISABLE_MEM_POOLS is set, loop through and free the poll records

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)
This commit is contained in:
Owen Taylor 2003-08-25 16:20:41 +00:00 committed by Owen Taylor
parent 610240c411
commit 2afc40f3a6
7 changed files with 68 additions and 1 deletions

View 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> 2003-08-22 Samúel Jón Gunnarsson <sammi@techattack.nu>
* is.po: Added "is" to ALL_LINGUAS. * is.po: Added "is" to ALL_LINGUAS.

View 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> 2003-08-22 Samúel Jón Gunnarsson <sammi@techattack.nu>
* is.po: Added "is" to ALL_LINGUAS. * is.po: Added "is" to ALL_LINGUAS.

View 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> 2003-08-22 Samúel Jón Gunnarsson <sammi@techattack.nu>
* is.po: Added "is" to ALL_LINGUAS. * is.po: Added "is" to ALL_LINGUAS.

View 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> 2003-08-22 Samúel Jón Gunnarsson <sammi@techattack.nu>
* is.po: Added "is" to ALL_LINGUAS. * is.po: Added "is" to ALL_LINGUAS.

View 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> 2003-08-22 Samúel Jón Gunnarsson <sammi@techattack.nu>
* is.po: Added "is" to ALL_LINGUAS. * is.po: Added "is" to ALL_LINGUAS.

View 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> 2003-08-22 Samúel Jón Gunnarsson <sammi@techattack.nu>
* is.po: Added "is" to ALL_LINGUAS. * is.po: Added "is" to ALL_LINGUAS.

View File

@ -553,6 +553,26 @@ g_main_context_ref (GMainContext *context)
UNLOCK_CONTEXT (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 static void
g_main_context_unref_and_unlock (GMainContext *context) 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_ptr_array_free (context->pending_dispatches, TRUE);
g_free (context->cached_poll_array); 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) if (context->poll_chunk)
g_mem_chunk_destroy (context->poll_chunk); g_mem_chunk_destroy (context->poll_chunk);