mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-14 14:27:14 +01:00
Remove pollfds from the context here, not when actually freeing the
Sun Dec 10 10:47:11 2000 Owen Taylor <otaylor@redhat.com> * gmain.c (g_source_destroy_internal): Remove pollfds from the context here, not when actually freeing the source. * gmain.c (g_source_unref_internal): Free source list and source, call source->source_funcs->destroy(). * giochannel.c: Unreference io_channel properly.
This commit is contained in:
parent
31fc683b98
commit
cbd74878d1
19
ChangeLog
19
ChangeLog
@ -1,3 +1,22 @@
|
|||||||
|
Sun Dec 10 10:47:11 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gmain.c (g_source_destroy_internal): Remove pollfds
|
||||||
|
from the context here, not when actually freeing the
|
||||||
|
source.
|
||||||
|
|
||||||
|
* gmain.c (g_source_unref_internal): Free source list
|
||||||
|
and source, call source->source_funcs->destroy().
|
||||||
|
|
||||||
|
* giochannel.c: Unreference io_channel properly.
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
2000-12-08 Raja R Harinath <harinath@cs.umn.edu>
|
2000-12-08 Raja R Harinath <harinath@cs.umn.edu>
|
||||||
|
|
||||||
* acglib.m4 (GLIB_AC_DIVERT_BEFORE_HELP):
|
* acglib.m4 (GLIB_AC_DIVERT_BEFORE_HELP):
|
||||||
|
@ -1,3 +1,22 @@
|
|||||||
|
Sun Dec 10 10:47:11 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gmain.c (g_source_destroy_internal): Remove pollfds
|
||||||
|
from the context here, not when actually freeing the
|
||||||
|
source.
|
||||||
|
|
||||||
|
* gmain.c (g_source_unref_internal): Free source list
|
||||||
|
and source, call source->source_funcs->destroy().
|
||||||
|
|
||||||
|
* giochannel.c: Unreference io_channel properly.
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
2000-12-08 Raja R Harinath <harinath@cs.umn.edu>
|
2000-12-08 Raja R Harinath <harinath@cs.umn.edu>
|
||||||
|
|
||||||
* acglib.m4 (GLIB_AC_DIVERT_BEFORE_HELP):
|
* acglib.m4 (GLIB_AC_DIVERT_BEFORE_HELP):
|
||||||
|
@ -1,3 +1,22 @@
|
|||||||
|
Sun Dec 10 10:47:11 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gmain.c (g_source_destroy_internal): Remove pollfds
|
||||||
|
from the context here, not when actually freeing the
|
||||||
|
source.
|
||||||
|
|
||||||
|
* gmain.c (g_source_unref_internal): Free source list
|
||||||
|
and source, call source->source_funcs->destroy().
|
||||||
|
|
||||||
|
* giochannel.c: Unreference io_channel properly.
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
2000-12-08 Raja R Harinath <harinath@cs.umn.edu>
|
2000-12-08 Raja R Harinath <harinath@cs.umn.edu>
|
||||||
|
|
||||||
* acglib.m4 (GLIB_AC_DIVERT_BEFORE_HELP):
|
* acglib.m4 (GLIB_AC_DIVERT_BEFORE_HELP):
|
||||||
|
@ -1,3 +1,22 @@
|
|||||||
|
Sun Dec 10 10:47:11 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gmain.c (g_source_destroy_internal): Remove pollfds
|
||||||
|
from the context here, not when actually freeing the
|
||||||
|
source.
|
||||||
|
|
||||||
|
* gmain.c (g_source_unref_internal): Free source list
|
||||||
|
and source, call source->source_funcs->destroy().
|
||||||
|
|
||||||
|
* giochannel.c: Unreference io_channel properly.
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
2000-12-08 Raja R Harinath <harinath@cs.umn.edu>
|
2000-12-08 Raja R Harinath <harinath@cs.umn.edu>
|
||||||
|
|
||||||
* acglib.m4 (GLIB_AC_DIVERT_BEFORE_HELP):
|
* acglib.m4 (GLIB_AC_DIVERT_BEFORE_HELP):
|
||||||
|
@ -1,3 +1,22 @@
|
|||||||
|
Sun Dec 10 10:47:11 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gmain.c (g_source_destroy_internal): Remove pollfds
|
||||||
|
from the context here, not when actually freeing the
|
||||||
|
source.
|
||||||
|
|
||||||
|
* gmain.c (g_source_unref_internal): Free source list
|
||||||
|
and source, call source->source_funcs->destroy().
|
||||||
|
|
||||||
|
* giochannel.c: Unreference io_channel properly.
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
2000-12-08 Raja R Harinath <harinath@cs.umn.edu>
|
2000-12-08 Raja R Harinath <harinath@cs.umn.edu>
|
||||||
|
|
||||||
* acglib.m4 (GLIB_AC_DIVERT_BEFORE_HELP):
|
* acglib.m4 (GLIB_AC_DIVERT_BEFORE_HELP):
|
||||||
|
@ -1,3 +1,22 @@
|
|||||||
|
Sun Dec 10 10:47:11 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gmain.c (g_source_destroy_internal): Remove pollfds
|
||||||
|
from the context here, not when actually freeing the
|
||||||
|
source.
|
||||||
|
|
||||||
|
* gmain.c (g_source_unref_internal): Free source list
|
||||||
|
and source, call source->source_funcs->destroy().
|
||||||
|
|
||||||
|
* giochannel.c: Unreference io_channel properly.
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
2000-12-08 Raja R Harinath <harinath@cs.umn.edu>
|
2000-12-08 Raja R Harinath <harinath@cs.umn.edu>
|
||||||
|
|
||||||
* acglib.m4 (GLIB_AC_DIVERT_BEFORE_HELP):
|
* acglib.m4 (GLIB_AC_DIVERT_BEFORE_HELP):
|
||||||
|
@ -1,3 +1,22 @@
|
|||||||
|
Sun Dec 10 10:47:11 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gmain.c (g_source_destroy_internal): Remove pollfds
|
||||||
|
from the context here, not when actually freeing the
|
||||||
|
source.
|
||||||
|
|
||||||
|
* gmain.c (g_source_unref_internal): Free source list
|
||||||
|
and source, call source->source_funcs->destroy().
|
||||||
|
|
||||||
|
* giochannel.c: Unreference io_channel properly.
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
2000-12-08 Raja R Harinath <harinath@cs.umn.edu>
|
2000-12-08 Raja R Harinath <harinath@cs.umn.edu>
|
||||||
|
|
||||||
* acglib.m4 (GLIB_AC_DIVERT_BEFORE_HELP):
|
* acglib.m4 (GLIB_AC_DIVERT_BEFORE_HELP):
|
||||||
|
@ -1,3 +1,22 @@
|
|||||||
|
Sun Dec 10 10:47:11 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gmain.c (g_source_destroy_internal): Remove pollfds
|
||||||
|
from the context here, not when actually freeing the
|
||||||
|
source.
|
||||||
|
|
||||||
|
* gmain.c (g_source_unref_internal): Free source list
|
||||||
|
and source, call source->source_funcs->destroy().
|
||||||
|
|
||||||
|
* giochannel.c: Unreference io_channel properly.
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
2000-12-08 Raja R Harinath <harinath@cs.umn.edu>
|
2000-12-08 Raja R Harinath <harinath@cs.umn.edu>
|
||||||
|
|
||||||
* acglib.m4 (GLIB_AC_DIVERT_BEFORE_HELP):
|
* acglib.m4 (GLIB_AC_DIVERT_BEFORE_HELP):
|
||||||
|
@ -122,6 +122,7 @@ g_io_add_watch_full (GIOChannel *channel,
|
|||||||
GDestroyNotify notify)
|
GDestroyNotify notify)
|
||||||
{
|
{
|
||||||
GSource *source;
|
GSource *source;
|
||||||
|
guint id;
|
||||||
|
|
||||||
g_return_val_if_fail (channel != NULL, 0);
|
g_return_val_if_fail (channel != NULL, 0);
|
||||||
|
|
||||||
@ -131,7 +132,10 @@ g_io_add_watch_full (GIOChannel *channel,
|
|||||||
g_source_set_priority (source, priority);
|
g_source_set_priority (source, priority);
|
||||||
g_source_set_callback (source, (GSourceFunc)func, user_data, notify);
|
g_source_set_callback (source, (GSourceFunc)func, user_data, notify);
|
||||||
|
|
||||||
return g_source_attach (source, NULL);
|
id = g_source_attach (source, NULL);
|
||||||
|
g_source_unref (source);
|
||||||
|
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
guint
|
guint
|
||||||
|
@ -122,6 +122,7 @@ g_io_add_watch_full (GIOChannel *channel,
|
|||||||
GDestroyNotify notify)
|
GDestroyNotify notify)
|
||||||
{
|
{
|
||||||
GSource *source;
|
GSource *source;
|
||||||
|
guint id;
|
||||||
|
|
||||||
g_return_val_if_fail (channel != NULL, 0);
|
g_return_val_if_fail (channel != NULL, 0);
|
||||||
|
|
||||||
@ -131,7 +132,10 @@ g_io_add_watch_full (GIOChannel *channel,
|
|||||||
g_source_set_priority (source, priority);
|
g_source_set_priority (source, priority);
|
||||||
g_source_set_callback (source, (GSourceFunc)func, user_data, notify);
|
g_source_set_callback (source, (GSourceFunc)func, user_data, notify);
|
||||||
|
|
||||||
return g_source_attach (source, NULL);
|
id = g_source_attach (source, NULL);
|
||||||
|
g_source_unref (source);
|
||||||
|
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
guint
|
guint
|
||||||
|
27
glib/gmain.c
27
glib/gmain.c
@ -782,6 +782,7 @@ g_source_destroy_internal (GSource *source,
|
|||||||
|
|
||||||
if (!SOURCE_DESTROYED (source))
|
if (!SOURCE_DESTROYED (source))
|
||||||
{
|
{
|
||||||
|
GSList *tmp_list;
|
||||||
gpointer old_cb_data;
|
gpointer old_cb_data;
|
||||||
GSourceCallbackFuncs *old_cb_funcs;
|
GSourceCallbackFuncs *old_cb_funcs;
|
||||||
|
|
||||||
@ -800,6 +801,13 @@ g_source_destroy_internal (GSource *source,
|
|||||||
LOCK_CONTEXT (context);
|
LOCK_CONTEXT (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tmp_list = source->poll_fds;
|
||||||
|
while (tmp_list)
|
||||||
|
{
|
||||||
|
g_main_context_remove_poll_unlocked (context, tmp_list->data);
|
||||||
|
tmp_list = tmp_list->next;
|
||||||
|
}
|
||||||
|
|
||||||
g_source_unref_internal (source, context, TRUE);
|
g_source_unref_internal (source, context, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -894,6 +902,7 @@ g_source_add_poll (GSource *source,
|
|||||||
|
|
||||||
g_return_if_fail (source != NULL);
|
g_return_if_fail (source != NULL);
|
||||||
g_return_if_fail (fd != NULL);
|
g_return_if_fail (fd != NULL);
|
||||||
|
g_return_val_if_fail (!SOURCE_DESTROYED (source), 0);
|
||||||
|
|
||||||
context = source->context;
|
context = source->context;
|
||||||
|
|
||||||
@ -1179,17 +1188,15 @@ g_source_unref_internal (GSource *source,
|
|||||||
g_warning (G_STRLOC ": ref_count == 0, but source is still attached to a context!");
|
g_warning (G_STRLOC ": ref_count == 0, but source is still attached to a context!");
|
||||||
source->ref_count++;
|
source->ref_count++;
|
||||||
}
|
}
|
||||||
else
|
else if (context)
|
||||||
{
|
g_source_list_remove (source, context);
|
||||||
g_source_list_remove (source, context);
|
|
||||||
|
|
||||||
tmp_list = source->poll_fds;
|
if (source->source_funcs->destroy)
|
||||||
while (tmp_list)
|
source->source_funcs->destroy (source);
|
||||||
{
|
|
||||||
g_main_context_remove_poll_unlocked (context, tmp_list->data);
|
g_slist_free (source->poll_fds);
|
||||||
tmp_list = tmp_list->next;
|
source->poll_fds = NULL;
|
||||||
}
|
g_free (source);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!have_lock && context)
|
if (!have_lock && context)
|
||||||
|
@ -71,7 +71,7 @@ struct _GSourceFuncs
|
|||||||
gboolean (*dispatch) (GSource *source,
|
gboolean (*dispatch) (GSource *source,
|
||||||
GSourceFunc callback,
|
GSourceFunc callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
void (*destroy) (GSource *source);
|
void (*destroy) (GSource *source); /* Can be NULL */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Any definitions using GPollFD or GPollFunc are primarily
|
/* Any definitions using GPollFD or GPollFunc are primarily
|
||||||
|
27
gmain.c
27
gmain.c
@ -782,6 +782,7 @@ g_source_destroy_internal (GSource *source,
|
|||||||
|
|
||||||
if (!SOURCE_DESTROYED (source))
|
if (!SOURCE_DESTROYED (source))
|
||||||
{
|
{
|
||||||
|
GSList *tmp_list;
|
||||||
gpointer old_cb_data;
|
gpointer old_cb_data;
|
||||||
GSourceCallbackFuncs *old_cb_funcs;
|
GSourceCallbackFuncs *old_cb_funcs;
|
||||||
|
|
||||||
@ -800,6 +801,13 @@ g_source_destroy_internal (GSource *source,
|
|||||||
LOCK_CONTEXT (context);
|
LOCK_CONTEXT (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tmp_list = source->poll_fds;
|
||||||
|
while (tmp_list)
|
||||||
|
{
|
||||||
|
g_main_context_remove_poll_unlocked (context, tmp_list->data);
|
||||||
|
tmp_list = tmp_list->next;
|
||||||
|
}
|
||||||
|
|
||||||
g_source_unref_internal (source, context, TRUE);
|
g_source_unref_internal (source, context, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -894,6 +902,7 @@ g_source_add_poll (GSource *source,
|
|||||||
|
|
||||||
g_return_if_fail (source != NULL);
|
g_return_if_fail (source != NULL);
|
||||||
g_return_if_fail (fd != NULL);
|
g_return_if_fail (fd != NULL);
|
||||||
|
g_return_val_if_fail (!SOURCE_DESTROYED (source), 0);
|
||||||
|
|
||||||
context = source->context;
|
context = source->context;
|
||||||
|
|
||||||
@ -1179,17 +1188,15 @@ g_source_unref_internal (GSource *source,
|
|||||||
g_warning (G_STRLOC ": ref_count == 0, but source is still attached to a context!");
|
g_warning (G_STRLOC ": ref_count == 0, but source is still attached to a context!");
|
||||||
source->ref_count++;
|
source->ref_count++;
|
||||||
}
|
}
|
||||||
else
|
else if (context)
|
||||||
{
|
g_source_list_remove (source, context);
|
||||||
g_source_list_remove (source, context);
|
|
||||||
|
|
||||||
tmp_list = source->poll_fds;
|
if (source->source_funcs->destroy)
|
||||||
while (tmp_list)
|
source->source_funcs->destroy (source);
|
||||||
{
|
|
||||||
g_main_context_remove_poll_unlocked (context, tmp_list->data);
|
g_slist_free (source->poll_fds);
|
||||||
tmp_list = tmp_list->next;
|
source->poll_fds = NULL;
|
||||||
}
|
g_free (source);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!have_lock && context)
|
if (!have_lock && context)
|
||||||
|
2
gmain.h
2
gmain.h
@ -71,7 +71,7 @@ struct _GSourceFuncs
|
|||||||
gboolean (*dispatch) (GSource *source,
|
gboolean (*dispatch) (GSource *source,
|
||||||
GSourceFunc callback,
|
GSourceFunc callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
void (*destroy) (GSource *source);
|
void (*destroy) (GSource *source); /* Can be NULL */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Any definitions using GPollFD or GPollFunc are primarily
|
/* Any definitions using GPollFD or GPollFunc are primarily
|
||||||
|
Loading…
x
Reference in New Issue
Block a user