diff options
author | Ryan Lortie <desrt@desrt.ca> | 2011-12-20 19:45:57 -0500 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2011-12-20 19:45:57 -0500 |
commit | 557da1650707bbb67b80be0c986598eab3893071 (patch) | |
tree | abde44d395606e70472c46f8c2578e74df6ee3b4 /gobject | |
parent | b2371871097ef2b52bdb4688d702438c9e3f1787 (diff) | |
download | glib-557da1650707bbb67b80be0c986598eab3893071.tar.gz |
GObject: do checks on interface property install
Add some checks to g_object_interface_install_property() similar to
those in g_object_class_install_property().
https://bugzilla.gnome.org/show_bug.cgi?id=666616
Diffstat (limited to 'gobject')
-rw-r--r-- | gobject/gobject.c | 8 | ||||
-rw-r--r-- | gobject/tests/param.c | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/gobject/gobject.c b/gobject/gobject.c index 446ea4a38..874096eef 100644 --- a/gobject/gobject.c +++ b/gobject/gobject.c @@ -706,7 +706,13 @@ g_object_interface_install_property (gpointer g_iface, g_return_if_fail (G_IS_PARAM_SPEC (pspec)); g_return_if_fail (!G_IS_PARAM_SPEC_OVERRIDE (pspec)); /* paranoid */ g_return_if_fail (PARAM_SPEC_PARAM_ID (pspec) == 0); /* paranoid */ - + + g_return_if_fail (pspec->flags & (G_PARAM_READABLE | G_PARAM_WRITABLE)); + if (pspec->flags & G_PARAM_CONSTRUCT) + g_return_if_fail ((pspec->flags & G_PARAM_CONSTRUCT_ONLY) == 0); + if (pspec->flags & (G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY)) + g_return_if_fail (pspec->flags & G_PARAM_WRITABLE); + install_property_internal (iface_class->g_type, 0, pspec); } diff --git a/gobject/tests/param.c b/gobject/tests/param.c index 2250d61a6..7e7721b91 100644 --- a/gobject/tests/param.c +++ b/gobject/tests/param.c @@ -487,7 +487,7 @@ test_interface_default_init (TestInterfaceInterface *iface) g_object_interface_install_property (iface, pspec); exit (0); } - //g_test_trap_assert_failed (); XXX g_object_interface_install_property has no checks + g_test_trap_assert_failed (); continue; } |