mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 06:56:14 +01:00
Add a bunch of unrefs.
Thu Dec 7 15:22:30 2000 Owen Taylor <otaylor@redhat.com> * tests/mainloop-test.c (recurser_start): Add a bunch of unrefs. * gmain.c (g_source_attach): Reference the source when adding (pointed out by Elliot)
This commit is contained in:
parent
e5c1f207c9
commit
1084477e03
13
glib/gmain.c
13
glib/gmain.c
@ -752,6 +752,7 @@ g_source_attach (GSource *source,
|
||||
source->context = context;
|
||||
result = source->id = context->next_id++;
|
||||
|
||||
source->ref_count++;
|
||||
g_source_list_add (source, context);
|
||||
|
||||
tmp_list = source->poll_fds;
|
||||
@ -2618,6 +2619,7 @@ g_timeout_add_full (gint priority,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
GSource *source;
|
||||
guint id;
|
||||
|
||||
g_return_val_if_fail (function != NULL, 0);
|
||||
|
||||
@ -2627,7 +2629,10 @@ g_timeout_add_full (gint priority,
|
||||
g_source_set_priority (source, priority);
|
||||
|
||||
g_source_set_callback (source, function, data, notify);
|
||||
return g_source_attach (source, NULL);
|
||||
id = g_source_attach (source, NULL);
|
||||
g_source_unref (source);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2731,6 +2736,7 @@ g_idle_add_full (gint priority,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
GSource *source;
|
||||
guint id;
|
||||
|
||||
g_return_val_if_fail (function != NULL, 0);
|
||||
|
||||
@ -2740,7 +2746,10 @@ g_idle_add_full (gint priority,
|
||||
g_source_set_priority (source, priority);
|
||||
|
||||
g_source_set_callback (source, function, data, notify);
|
||||
return g_source_attach (source, NULL);
|
||||
id = g_source_attach (source, NULL);
|
||||
g_source_unref (source);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
13
gmain.c
13
gmain.c
@ -752,6 +752,7 @@ g_source_attach (GSource *source,
|
||||
source->context = context;
|
||||
result = source->id = context->next_id++;
|
||||
|
||||
source->ref_count++;
|
||||
g_source_list_add (source, context);
|
||||
|
||||
tmp_list = source->poll_fds;
|
||||
@ -2618,6 +2619,7 @@ g_timeout_add_full (gint priority,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
GSource *source;
|
||||
guint id;
|
||||
|
||||
g_return_val_if_fail (function != NULL, 0);
|
||||
|
||||
@ -2627,7 +2629,10 @@ g_timeout_add_full (gint priority,
|
||||
g_source_set_priority (source, priority);
|
||||
|
||||
g_source_set_callback (source, function, data, notify);
|
||||
return g_source_attach (source, NULL);
|
||||
id = g_source_attach (source, NULL);
|
||||
g_source_unref (source);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2731,6 +2736,7 @@ g_idle_add_full (gint priority,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
GSource *source;
|
||||
guint id;
|
||||
|
||||
g_return_val_if_fail (function != NULL, 0);
|
||||
|
||||
@ -2740,7 +2746,10 @@ g_idle_add_full (gint priority,
|
||||
g_source_set_priority (source, priority);
|
||||
|
||||
g_source_set_callback (source, function, data, notify);
|
||||
return g_source_attach (source, NULL);
|
||||
id = g_source_attach (source, NULL);
|
||||
g_source_unref (source);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -138,11 +138,13 @@ adder_thread (gpointer data)
|
||||
adder_source = g_io_create_watch (channels[0], G_IO_IN | G_IO_HUP);
|
||||
g_source_set_callback (adder_source, (GSourceFunc)adder_callback, &addr_data, NULL);
|
||||
g_source_attach (adder_source, context);
|
||||
g_source_unref (adder_source);
|
||||
|
||||
timeout_source = g_timeout_source_new (10);
|
||||
g_source_set_callback (timeout_source, (GSourceFunc)timeout_callback, &addr_data, NULL);
|
||||
g_source_set_priority (timeout_source, G_PRIORITY_HIGH);
|
||||
g_source_attach (timeout_source, context);
|
||||
g_source_unref (timeout_source);
|
||||
|
||||
g_main_run (addr_data.loop);
|
||||
|
||||
@ -312,6 +314,7 @@ create_crawler (void)
|
||||
|
||||
G_LOCK (context_array_lock);
|
||||
g_source_attach (source, context_array->pdata[g_random_int_range (0, context_array->len)]);
|
||||
g_source_unref (source);
|
||||
G_UNLOCK (context_array_lock);
|
||||
|
||||
G_LOCK (crawler_array_lock);
|
||||
@ -359,6 +362,7 @@ recurser_start (gpointer data)
|
||||
source = g_idle_source_new ();
|
||||
g_source_set_callback (source, recurser_idle, context, NULL);
|
||||
g_source_attach (source, context);
|
||||
g_source_unref (source);
|
||||
G_UNLOCK (context_array_lock);
|
||||
|
||||
return TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user