mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-01 11:36:51 +02:00
added a "release_check" to the OutArgument structure, which, if present,
2001-07-26 Michael Natterer <mitch@convergence.de> * gobject/glib-genmarshal.c: added a "release_check" to the OutArgument structure, which, if present, gets integrated in the marshaller code and protects us from stuff like g_object_unref(NULL) on marshaller return values.
This commit is contained in:
parent
8caf4a8c43
commit
9b25010f22
@ -1,3 +1,10 @@
|
|||||||
|
2001-07-26 Michael Natterer <mitch@convergence.de>
|
||||||
|
|
||||||
|
* gobject/glib-genmarshal.c: added a "release_check" to the
|
||||||
|
OutArgument structure, which, if present, gets integrated in the
|
||||||
|
marshaller code and protects us from stuff like
|
||||||
|
g_object_unref(NULL) on marshaller return values.
|
||||||
|
|
||||||
2001-07-23 Padraig O'Briain <Padraig.Obriain@sun.com>
|
2001-07-23 Padraig O'Briain <Padraig.Obriain@sun.com>
|
||||||
|
|
||||||
* gobject/gobjectnotifyqueue.c: fix unconditional check of
|
* gobject/gobjectnotifyqueue.c: fix unconditional check of
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2001-07-26 Michael Natterer <mitch@convergence.de>
|
||||||
|
|
||||||
|
* gobject/glib-genmarshal.c: added a "release_check" to the
|
||||||
|
OutArgument structure, which, if present, gets integrated in the
|
||||||
|
marshaller code and protects us from stuff like
|
||||||
|
g_object_unref(NULL) on marshaller return values.
|
||||||
|
|
||||||
2001-07-23 Padraig O'Briain <Padraig.Obriain@sun.com>
|
2001-07-23 Padraig O'Briain <Padraig.Obriain@sun.com>
|
||||||
|
|
||||||
* gobject/gobjectnotifyqueue.c: fix unconditional check of
|
* gobject/gobjectnotifyqueue.c: fix unconditional check of
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2001-07-26 Michael Natterer <mitch@convergence.de>
|
||||||
|
|
||||||
|
* gobject/glib-genmarshal.c: added a "release_check" to the
|
||||||
|
OutArgument structure, which, if present, gets integrated in the
|
||||||
|
marshaller code and protects us from stuff like
|
||||||
|
g_object_unref(NULL) on marshaller return values.
|
||||||
|
|
||||||
2001-07-23 Padraig O'Briain <Padraig.Obriain@sun.com>
|
2001-07-23 Padraig O'Briain <Padraig.Obriain@sun.com>
|
||||||
|
|
||||||
* gobject/gobjectnotifyqueue.c: fix unconditional check of
|
* gobject/gobjectnotifyqueue.c: fix unconditional check of
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2001-07-26 Michael Natterer <mitch@convergence.de>
|
||||||
|
|
||||||
|
* gobject/glib-genmarshal.c: added a "release_check" to the
|
||||||
|
OutArgument structure, which, if present, gets integrated in the
|
||||||
|
marshaller code and protects us from stuff like
|
||||||
|
g_object_unref(NULL) on marshaller return values.
|
||||||
|
|
||||||
2001-07-23 Padraig O'Briain <Padraig.Obriain@sun.com>
|
2001-07-23 Padraig O'Briain <Padraig.Obriain@sun.com>
|
||||||
|
|
||||||
* gobject/gobjectnotifyqueue.c: fix unconditional check of
|
* gobject/gobjectnotifyqueue.c: fix unconditional check of
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2001-07-26 Michael Natterer <mitch@convergence.de>
|
||||||
|
|
||||||
|
* gobject/glib-genmarshal.c: added a "release_check" to the
|
||||||
|
OutArgument structure, which, if present, gets integrated in the
|
||||||
|
marshaller code and protects us from stuff like
|
||||||
|
g_object_unref(NULL) on marshaller return values.
|
||||||
|
|
||||||
2001-07-23 Padraig O'Briain <Padraig.Obriain@sun.com>
|
2001-07-23 Padraig O'Briain <Padraig.Obriain@sun.com>
|
||||||
|
|
||||||
* gobject/gobjectnotifyqueue.c: fix unconditional check of
|
* gobject/gobjectnotifyqueue.c: fix unconditional check of
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2001-07-26 Michael Natterer <mitch@convergence.de>
|
||||||
|
|
||||||
|
* gobject/glib-genmarshal.c: added a "release_check" to the
|
||||||
|
OutArgument structure, which, if present, gets integrated in the
|
||||||
|
marshaller code and protects us from stuff like
|
||||||
|
g_object_unref(NULL) on marshaller return values.
|
||||||
|
|
||||||
2001-07-23 Padraig O'Briain <Padraig.Obriain@sun.com>
|
2001-07-23 Padraig O'Briain <Padraig.Obriain@sun.com>
|
||||||
|
|
||||||
* gobject/gobjectnotifyqueue.c: fix unconditional check of
|
* gobject/gobjectnotifyqueue.c: fix unconditional check of
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2001-07-26 Michael Natterer <mitch@convergence.de>
|
||||||
|
|
||||||
|
* gobject/glib-genmarshal.c: added a "release_check" to the
|
||||||
|
OutArgument structure, which, if present, gets integrated in the
|
||||||
|
marshaller code and protects us from stuff like
|
||||||
|
g_object_unref(NULL) on marshaller return values.
|
||||||
|
|
||||||
2001-07-23 Padraig O'Briain <Padraig.Obriain@sun.com>
|
2001-07-23 Padraig O'Briain <Padraig.Obriain@sun.com>
|
||||||
|
|
||||||
* gobject/gobjectnotifyqueue.c: fix unconditional check of
|
* gobject/gobjectnotifyqueue.c: fix unconditional check of
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2001-07-26 Michael Natterer <mitch@convergence.de>
|
||||||
|
|
||||||
|
* gobject/glib-genmarshal.c: added a "release_check" to the
|
||||||
|
OutArgument structure, which, if present, gets integrated in the
|
||||||
|
marshaller code and protects us from stuff like
|
||||||
|
g_object_unref(NULL) on marshaller return values.
|
||||||
|
|
||||||
2001-07-23 Padraig O'Briain <Padraig.Obriain@sun.com>
|
2001-07-23 Padraig O'Briain <Padraig.Obriain@sun.com>
|
||||||
|
|
||||||
* gobject/gobjectnotifyqueue.c: fix unconditional check of
|
* gobject/gobjectnotifyqueue.c: fix unconditional check of
|
||||||
|
@ -62,6 +62,7 @@ typedef struct
|
|||||||
const gchar *ctype; /* C type name [gchar*] */
|
const gchar *ctype; /* C type name [gchar*] */
|
||||||
const gchar *setter; /* value setter function [g_value_set_string] */
|
const gchar *setter; /* value setter function [g_value_set_string] */
|
||||||
const gchar *release; /* value release function [g_free] */
|
const gchar *release; /* value release function [g_free] */
|
||||||
|
const gchar *release_check; /* checks if release function is safe to call */
|
||||||
} OutArgument;
|
} OutArgument;
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@ -177,27 +178,27 @@ static gboolean
|
|||||||
complete_out_arg (OutArgument *oarg)
|
complete_out_arg (OutArgument *oarg)
|
||||||
{
|
{
|
||||||
static const OutArgument args[] = {
|
static const OutArgument args[] = {
|
||||||
/* keyword sig_name ctype setter release */
|
/* keyword sig_name ctype setter release release_check */
|
||||||
{ "VOID", "VOID", "void", NULL, NULL, },
|
{ "VOID", "VOID", "void", NULL, NULL, NULL },
|
||||||
{ "BOOLEAN", "BOOLEAN", "gboolean", "g_value_set_boolean", NULL, },
|
{ "BOOLEAN", "BOOLEAN", "gboolean", "g_value_set_boolean", NULL, NULL },
|
||||||
{ "CHAR", "CHAR", "gchar", "g_value_set_char", NULL, },
|
{ "CHAR", "CHAR", "gchar", "g_value_set_char", NULL, NULL },
|
||||||
{ "UCHAR", "UCHAR", "guchar", "g_value_set_uchar", NULL, },
|
{ "UCHAR", "UCHAR", "guchar", "g_value_set_uchar", NULL, NULL },
|
||||||
{ "INT", "INT", "gint", "g_value_set_int", NULL, },
|
{ "INT", "INT", "gint", "g_value_set_int", NULL, NULL },
|
||||||
{ "UINT", "UINT", "guint", "g_value_set_uint", NULL, },
|
{ "UINT", "UINT", "guint", "g_value_set_uint", NULL, NULL },
|
||||||
{ "LONG", "LONG", "glong", "g_value_set_long", NULL, },
|
{ "LONG", "LONG", "glong", "g_value_set_long", NULL, NULL },
|
||||||
{ "ULONG", "ULONG", "gulong", "g_value_set_ulong", NULL, },
|
{ "ULONG", "ULONG", "gulong", "g_value_set_ulong", NULL, NULL },
|
||||||
{ "ENUM", "ENUM", "gint", "g_value_set_enum", NULL, },
|
{ "ENUM", "ENUM", "gint", "g_value_set_enum", NULL, NULL },
|
||||||
{ "FLAGS", "FLAGS", "guint", "g_value_set_flags", NULL, },
|
{ "FLAGS", "FLAGS", "guint", "g_value_set_flags", NULL, NULL },
|
||||||
{ "FLOAT", "FLOAT", "gfloat", "g_value_set_float", NULL, },
|
{ "FLOAT", "FLOAT", "gfloat", "g_value_set_float", NULL, NULL },
|
||||||
{ "DOUBLE", "DOUBLE", "gdouble", "g_value_set_double", NULL, },
|
{ "DOUBLE", "DOUBLE", "gdouble", "g_value_set_double", NULL, NULL },
|
||||||
{ "STRING", "STRING", "gchar*", "g_value_set_string_take_ownership", NULL, },
|
{ "STRING", "STRING", "gchar*", "g_value_set_string_take_ownership", NULL, NULL },
|
||||||
{ "PARAM", "PARAM", "GParamSpec*", "g_value_set_param", "g_param_spec_unref", },
|
{ "PARAM", "PARAM", "GParamSpec*", "g_value_set_param", "g_param_spec_unref", NULL },
|
||||||
{ "BOXED", "BOXED", "gpointer", "g_value_set_boxed_take_ownership", NULL, },
|
{ "BOXED", "BOXED", "gpointer", "g_value_set_boxed_take_ownership", NULL, NULL },
|
||||||
{ "POINTER", "POINTER", "gpointer", "g_value_set_pointer", NULL, },
|
{ "POINTER", "POINTER", "gpointer", "g_value_set_pointer", NULL, NULL },
|
||||||
{ "OBJECT", "OBJECT", "GObject*", "g_value_set_object", "g_object_unref", },
|
{ "OBJECT", "OBJECT", "GObject*", "g_value_set_object", "g_object_unref", "NULL !=" },
|
||||||
/* deprecated: */
|
/* deprecated: */
|
||||||
{ "NONE", "VOID", "void", NULL, NULL, },
|
{ "NONE", "VOID", "void", NULL, NULL, NULL },
|
||||||
{ "BOOL", "BOOLEAN", "gboolean", "g_value_set_boolean", NULL, },
|
{ "BOOL", "BOOLEAN", "gboolean", "g_value_set_boolean", NULL, NULL }
|
||||||
};
|
};
|
||||||
const guint n_args = sizeof (args) / sizeof (args[0]);
|
const guint n_args = sizeof (args) / sizeof (args[0]);
|
||||||
guint i;
|
guint i;
|
||||||
@ -211,6 +212,7 @@ complete_out_arg (OutArgument *oarg)
|
|||||||
oarg->ctype = args[i].ctype;
|
oarg->ctype = args[i].ctype;
|
||||||
oarg->setter = args[i].setter;
|
oarg->setter = args[i].setter;
|
||||||
oarg->release = args[i].release;
|
oarg->release = args[i].release;
|
||||||
|
oarg->release_check = args[i].release_check;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -398,7 +400,18 @@ generate_marshal (const gchar *signame,
|
|||||||
fprintf (fout, "\n");
|
fprintf (fout, "\n");
|
||||||
fprintf (fout, " %s (return_value, v_return);\n", sig->rarg->setter);
|
fprintf (fout, " %s (return_value, v_return);\n", sig->rarg->setter);
|
||||||
if (sig->rarg->release)
|
if (sig->rarg->release)
|
||||||
fprintf (fout, " %s (v_return);\n", sig->rarg->release);
|
{
|
||||||
|
if (sig->rarg->release_check)
|
||||||
|
{
|
||||||
|
fprintf (fout, " if (%s (v_return))\n", sig->rarg->release_check);
|
||||||
|
fprintf (fout, " %s (v_return);\n", sig->rarg->release);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fprintf (fout, " %s (v_return);\n", sig->rarg->release);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* cfile marshal footer */
|
/* cfile marshal footer */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user