mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-06-03 11:20:07 +02:00
Unref callback->cb_data if it was still set when the source is freed.
Wed Dec 13 20:41:49 2000 Owen Taylor <otaylor@redhat.com> * gmain.c (g_source_unref_internal): Unref callback->cb_data if it was still set when the source is freed. (Usually, this will be done by g_source_destroy.)
This commit is contained in:
parent
2b579b5933
commit
07267bf096
@ -1,3 +1,9 @@
|
|||||||
|
Wed Dec 13 20:41:49 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gmain.c (g_source_unref_internal): Unref callback->cb_data
|
||||||
|
if it was still set when the source is freed. (Usually, this
|
||||||
|
will be done by g_source_destroy.)
|
||||||
|
|
||||||
2001-01-02 Dan Winship <danw@helixcode.com>
|
2001-01-02 Dan Winship <danw@helixcode.com>
|
||||||
|
|
||||||
* garray.h (g_array_append_val, g_array_prepend_val,
|
* garray.h (g_array_append_val, g_array_prepend_val,
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Wed Dec 13 20:41:49 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gmain.c (g_source_unref_internal): Unref callback->cb_data
|
||||||
|
if it was still set when the source is freed. (Usually, this
|
||||||
|
will be done by g_source_destroy.)
|
||||||
|
|
||||||
2001-01-02 Dan Winship <danw@helixcode.com>
|
2001-01-02 Dan Winship <danw@helixcode.com>
|
||||||
|
|
||||||
* garray.h (g_array_append_val, g_array_prepend_val,
|
* garray.h (g_array_append_val, g_array_prepend_val,
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Wed Dec 13 20:41:49 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gmain.c (g_source_unref_internal): Unref callback->cb_data
|
||||||
|
if it was still set when the source is freed. (Usually, this
|
||||||
|
will be done by g_source_destroy.)
|
||||||
|
|
||||||
2001-01-02 Dan Winship <danw@helixcode.com>
|
2001-01-02 Dan Winship <danw@helixcode.com>
|
||||||
|
|
||||||
* garray.h (g_array_append_val, g_array_prepend_val,
|
* garray.h (g_array_append_val, g_array_prepend_val,
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Wed Dec 13 20:41:49 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gmain.c (g_source_unref_internal): Unref callback->cb_data
|
||||||
|
if it was still set when the source is freed. (Usually, this
|
||||||
|
will be done by g_source_destroy.)
|
||||||
|
|
||||||
2001-01-02 Dan Winship <danw@helixcode.com>
|
2001-01-02 Dan Winship <danw@helixcode.com>
|
||||||
|
|
||||||
* garray.h (g_array_append_val, g_array_prepend_val,
|
* garray.h (g_array_append_val, g_array_prepend_val,
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Wed Dec 13 20:41:49 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gmain.c (g_source_unref_internal): Unref callback->cb_data
|
||||||
|
if it was still set when the source is freed. (Usually, this
|
||||||
|
will be done by g_source_destroy.)
|
||||||
|
|
||||||
2001-01-02 Dan Winship <danw@helixcode.com>
|
2001-01-02 Dan Winship <danw@helixcode.com>
|
||||||
|
|
||||||
* garray.h (g_array_append_val, g_array_prepend_val,
|
* garray.h (g_array_append_val, g_array_prepend_val,
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Wed Dec 13 20:41:49 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gmain.c (g_source_unref_internal): Unref callback->cb_data
|
||||||
|
if it was still set when the source is freed. (Usually, this
|
||||||
|
will be done by g_source_destroy.)
|
||||||
|
|
||||||
2001-01-02 Dan Winship <danw@helixcode.com>
|
2001-01-02 Dan Winship <danw@helixcode.com>
|
||||||
|
|
||||||
* garray.h (g_array_append_val, g_array_prepend_val,
|
* garray.h (g_array_append_val, g_array_prepend_val,
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Wed Dec 13 20:41:49 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gmain.c (g_source_unref_internal): Unref callback->cb_data
|
||||||
|
if it was still set when the source is freed. (Usually, this
|
||||||
|
will be done by g_source_destroy.)
|
||||||
|
|
||||||
2001-01-02 Dan Winship <danw@helixcode.com>
|
2001-01-02 Dan Winship <danw@helixcode.com>
|
||||||
|
|
||||||
* garray.h (g_array_append_val, g_array_prepend_val,
|
* garray.h (g_array_append_val, g_array_prepend_val,
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Wed Dec 13 20:41:49 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gmain.c (g_source_unref_internal): Unref callback->cb_data
|
||||||
|
if it was still set when the source is freed. (Usually, this
|
||||||
|
will be done by g_source_destroy.)
|
||||||
|
|
||||||
2001-01-02 Dan Winship <danw@helixcode.com>
|
2001-01-02 Dan Winship <danw@helixcode.com>
|
||||||
|
|
||||||
* garray.h (g_array_append_val, g_array_prepend_val,
|
* garray.h (g_array_append_val, g_array_prepend_val,
|
||||||
|
15
glib/gmain.c
15
glib/gmain.c
@ -1173,9 +1173,8 @@ g_source_unref_internal (GSource *source,
|
|||||||
GMainContext *context,
|
GMainContext *context,
|
||||||
gboolean have_lock)
|
gboolean have_lock)
|
||||||
{
|
{
|
||||||
gpointer cb_data = NULL;
|
gpointer old_cb_data = NULL;
|
||||||
GSourceCallbackFuncs *cb_funcs = NULL;
|
GSourceCallbackFuncs *old_cb_funcs = NULL;
|
||||||
GSList *tmp_list;
|
|
||||||
|
|
||||||
g_return_if_fail (source != NULL);
|
g_return_if_fail (source != NULL);
|
||||||
|
|
||||||
@ -1185,6 +1184,12 @@ g_source_unref_internal (GSource *source,
|
|||||||
source->ref_count--;
|
source->ref_count--;
|
||||||
if (source->ref_count == 0)
|
if (source->ref_count == 0)
|
||||||
{
|
{
|
||||||
|
old_cb_data = source->callback_data;
|
||||||
|
old_cb_funcs = source->callback_funcs;
|
||||||
|
|
||||||
|
source->callback_data = NULL;
|
||||||
|
source->callback_funcs = NULL;
|
||||||
|
|
||||||
if (context && !SOURCE_DESTROYED (source))
|
if (context && !SOURCE_DESTROYED (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!");
|
||||||
@ -1204,12 +1209,12 @@ g_source_unref_internal (GSource *source,
|
|||||||
if (!have_lock && context)
|
if (!have_lock && context)
|
||||||
UNLOCK_CONTEXT (context);
|
UNLOCK_CONTEXT (context);
|
||||||
|
|
||||||
if (cb_data)
|
if (old_cb_funcs)
|
||||||
{
|
{
|
||||||
if (have_lock)
|
if (have_lock)
|
||||||
UNLOCK_CONTEXT (context);
|
UNLOCK_CONTEXT (context);
|
||||||
|
|
||||||
cb_funcs->unref (cb_data);
|
old_cb_funcs->unref (old_cb_data);
|
||||||
|
|
||||||
if (have_lock)
|
if (have_lock)
|
||||||
LOCK_CONTEXT (context);
|
LOCK_CONTEXT (context);
|
||||||
|
15
gmain.c
15
gmain.c
@ -1173,9 +1173,8 @@ g_source_unref_internal (GSource *source,
|
|||||||
GMainContext *context,
|
GMainContext *context,
|
||||||
gboolean have_lock)
|
gboolean have_lock)
|
||||||
{
|
{
|
||||||
gpointer cb_data = NULL;
|
gpointer old_cb_data = NULL;
|
||||||
GSourceCallbackFuncs *cb_funcs = NULL;
|
GSourceCallbackFuncs *old_cb_funcs = NULL;
|
||||||
GSList *tmp_list;
|
|
||||||
|
|
||||||
g_return_if_fail (source != NULL);
|
g_return_if_fail (source != NULL);
|
||||||
|
|
||||||
@ -1185,6 +1184,12 @@ g_source_unref_internal (GSource *source,
|
|||||||
source->ref_count--;
|
source->ref_count--;
|
||||||
if (source->ref_count == 0)
|
if (source->ref_count == 0)
|
||||||
{
|
{
|
||||||
|
old_cb_data = source->callback_data;
|
||||||
|
old_cb_funcs = source->callback_funcs;
|
||||||
|
|
||||||
|
source->callback_data = NULL;
|
||||||
|
source->callback_funcs = NULL;
|
||||||
|
|
||||||
if (context && !SOURCE_DESTROYED (source))
|
if (context && !SOURCE_DESTROYED (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!");
|
||||||
@ -1204,12 +1209,12 @@ g_source_unref_internal (GSource *source,
|
|||||||
if (!have_lock && context)
|
if (!have_lock && context)
|
||||||
UNLOCK_CONTEXT (context);
|
UNLOCK_CONTEXT (context);
|
||||||
|
|
||||||
if (cb_data)
|
if (old_cb_funcs)
|
||||||
{
|
{
|
||||||
if (have_lock)
|
if (have_lock)
|
||||||
UNLOCK_CONTEXT (context);
|
UNLOCK_CONTEXT (context);
|
||||||
|
|
||||||
cb_funcs->unref (cb_data);
|
old_cb_funcs->unref (old_cb_data);
|
||||||
|
|
||||||
if (have_lock)
|
if (have_lock)
|
||||||
LOCK_CONTEXT (context);
|
LOCK_CONTEXT (context);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user