summaryrefslogtreecommitdiff
path: root/gmain.c
diff options
context:
space:
mode:
authorTim Janik <timj@gtk.org>1999-01-02 01:32:37 +0000
committerTim Janik <timj@src.gnome.org>1999-01-02 01:32:37 +0000
commit00e064d2af719c4a630156cef361de6365342aae (patch)
tree15441876b220855298e7725ce8fba97cb1953afe /gmain.c
parent0e2f565f144415c95a721b483c062239f82f0894 (diff)
downloadglib-00e064d2af719c4a630156cef361de6365342aae.tar.gz
avoid unneccessary extra hook referencing (the explicit hook referencing
Sat Jan 2 02:20:59 1999 Tim Janik <timj@gtk.org> * ghook.c: (g_hook_list_invoke): (g_hook_list_invoke_check): (g_hook_list_marshal_check): (g_hook_list_marshal): avoid unneccessary extra hook referencing (the explicit hook referencing became unneccessarry with my changes from Mon Dec 21 21:48:29 1998). * gmain.c (g_main_iterate): fixed reference counting leaks with premature loop aborts. Fri Jan 1 22:47:44 1999 Tim Janik <timj@gtk.org> * gscanner.c (g_scanner_unexp_token): handle G_TOKEN_IDENTIFIER_NULL as G_TOKEN_IDENTIFIER.
Diffstat (limited to 'gmain.c')
-rw-r--r--gmain.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/gmain.c b/gmain.c
index d5e3f848f..442138628 100644
--- a/gmain.c
+++ b/gmain.c
@@ -402,7 +402,7 @@ g_main_dispatch (GTimeVal *current_time)
}
}
- g_hook_unref (&source_list, (GHook *)source);
+ g_hook_unref (&source_list, (GHook*) source);
}
}
@@ -472,19 +472,19 @@ g_main_iterate (gboolean block,
while (hook)
{
GSource *source = (GSource *)hook;
- GHook *tmp;
gint source_timeout = -1;
if ((n_ready > 0) && (source->priority > current_priority))
- break;
+ {
+ g_hook_unref (&source_list, hook);
+ break;
+ }
if (G_HOOK_IN_CALL (hook) && !(hook->flags & G_SOURCE_CAN_RECURSE))
{
hook = g_hook_next_valid (&source_list, hook, TRUE);
continue;
}
- g_hook_ref (&source_list, hook);
-
if (hook->flags & G_SOURCE_READY ||
((GSourceFuncs *) hook->func)->prepare (source->source_data,
&current_time,
@@ -515,10 +515,7 @@ g_main_iterate (gboolean block,
timeout = MIN (timeout, source_timeout);
}
- tmp = g_hook_next_valid (&source_list, hook, TRUE);
-
- g_hook_unref (&source_list, hook);
- hook = tmp;
+ hook = g_hook_next_valid (&source_list, hook, TRUE);
}
/* poll(), if necessary */
@@ -533,18 +530,18 @@ g_main_iterate (gboolean block,
while (hook)
{
GSource *source = (GSource *)hook;
- GHook *tmp;
if ((n_ready > 0) && (source->priority > current_priority))
- break;
+ {
+ g_hook_unref (&source_list, hook);
+ break;
+ }
if (G_HOOK_IN_CALL (hook) && !(hook->flags & G_SOURCE_CAN_RECURSE))
{
hook = g_hook_next_valid (&source_list, hook, TRUE);
continue;
}
- g_hook_ref (&source_list, hook);
-
if (hook->flags & G_SOURCE_READY ||
((GSourceFuncs *) hook->func)->check (source->source_data,
&current_time))
@@ -566,10 +563,7 @@ g_main_iterate (gboolean block,
}
}
- tmp = g_hook_next_valid (&source_list, hook, TRUE);
-
- g_hook_unref (&source_list, hook);
- hook = tmp;
+ hook = g_hook_next_valid (&source_list, hook, TRUE);
}
/* Now invoke the callbacks */