From c55b9a4f44eb7e01ec5fa93fc63b0f34cceabc37 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Wed, 6 Feb 2002 00:37:38 +0000 Subject: [PATCH] Unref pending dispatches when discarding them. Tue Feb 5 17:13:02 2002 Owen Taylor * glib/gmain.c (g_main_context_prepare): Unref pending dispatches when discarding them. --- ChangeLog | 5 +++++ ChangeLog.pre-2-0 | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-12 | 5 +++++ ChangeLog.pre-2-2 | 5 +++++ ChangeLog.pre-2-4 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ glib/gmain.c | 4 ++++ 9 files changed, 44 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2a5212ace..880dc31c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Feb 5 17:13:02 2002 Owen Taylor + + * glib/gmain.c (g_main_context_prepare): Unref pending + dispatches when discarding them. + 2002-02-04 Sebastian Wilhelmi * glib/gthread.c (g_thread_create_full): Delay allocation until diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 2a5212ace..880dc31c2 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,8 @@ +Tue Feb 5 17:13:02 2002 Owen Taylor + + * glib/gmain.c (g_main_context_prepare): Unref pending + dispatches when discarding them. + 2002-02-04 Sebastian Wilhelmi * glib/gthread.c (g_thread_create_full): Delay allocation until diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 2a5212ace..880dc31c2 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +Tue Feb 5 17:13:02 2002 Owen Taylor + + * glib/gmain.c (g_main_context_prepare): Unref pending + dispatches when discarding them. + 2002-02-04 Sebastian Wilhelmi * glib/gthread.c (g_thread_create_full): Delay allocation until diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 2a5212ace..880dc31c2 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,8 @@ +Tue Feb 5 17:13:02 2002 Owen Taylor + + * glib/gmain.c (g_main_context_prepare): Unref pending + dispatches when discarding them. + 2002-02-04 Sebastian Wilhelmi * glib/gthread.c (g_thread_create_full): Delay allocation until diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 2a5212ace..880dc31c2 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +Tue Feb 5 17:13:02 2002 Owen Taylor + + * glib/gmain.c (g_main_context_prepare): Unref pending + dispatches when discarding them. + 2002-02-04 Sebastian Wilhelmi * glib/gthread.c (g_thread_create_full): Delay allocation until diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 2a5212ace..880dc31c2 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +Tue Feb 5 17:13:02 2002 Owen Taylor + + * glib/gmain.c (g_main_context_prepare): Unref pending + dispatches when discarding them. + 2002-02-04 Sebastian Wilhelmi * glib/gthread.c (g_thread_create_full): Delay allocation until diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 2a5212ace..880dc31c2 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +Tue Feb 5 17:13:02 2002 Owen Taylor + + * glib/gmain.c (g_main_context_prepare): Unref pending + dispatches when discarding them. + 2002-02-04 Sebastian Wilhelmi * glib/gthread.c (g_thread_create_full): Delay allocation until diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 2a5212ace..880dc31c2 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +Tue Feb 5 17:13:02 2002 Owen Taylor + + * glib/gmain.c (g_main_context_prepare): Unref pending + dispatches when discarding them. + 2002-02-04 Sebastian Wilhelmi * glib/gthread.c (g_thread_create_full): Delay allocation until diff --git a/glib/gmain.c b/glib/gmain.c index f3595962a..6f0c2bf31 100644 --- a/glib/gmain.c +++ b/glib/gmain.c @@ -1846,6 +1846,7 @@ gboolean g_main_context_prepare (GMainContext *context, gint *priority) { + gint i; gint n_ready = 0; gint current_priority = G_MAXINT; GSource *source; @@ -1889,6 +1890,9 @@ g_main_context_prepare (GMainContext *context, #endif /* If recursing, clear list of pending dispatches */ + + for (i = 0; i < context->pending_dispatches->len; i++) + SOURCE_UNREF ((GSource *)context->pending_dispatches->pdata[i], context); g_ptr_array_set_size (context->pending_dispatches, 0); /* Prepare all sources */