[glib/ebassi/issue-2770] Empty values are not valid GParamSpec
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/ebassi/issue-2770] Empty values are not valid GParamSpec
- Date: Sun, 25 Sep 2022 13:24:18 +0000 (UTC)
commit ea3f17d598d550345e94e4571130e429443e91cb
Author: Emmanuele Bassi <ebassi gnome org>
Date: Sun Sep 25 14:20:24 2022 +0100
Empty values are not valid GParamSpec
The validate() vfunc for GParamSpecParam returns FALSE for empty GValue,
which means the is_valid() vfunc should do the same.
This avoids a segfault when calling g_param_value_is_valid() on a
GParamSpecParam.
Fixes: #2770
gobject/gparamspecs.c | 3 +++
1 file changed, 3 insertions(+)
---
diff --git a/gobject/gparamspecs.c b/gobject/gparamspecs.c
index f17b3488b9..17b8606572 100644
--- a/gobject/gparamspecs.c
+++ b/gobject/gparamspecs.c
@@ -894,6 +894,9 @@ param_param_is_valid (GParamSpec *pspec,
{
GParamSpec *param = value->data[0].v_pointer;
+ if (param == NULL)
+ return FALSE;
+
return g_value_type_compatible (G_PARAM_SPEC_TYPE (param), G_PARAM_SPEC_VALUE_TYPE (pspec));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]