libgimpconfig/gimpconfig-deserialize.c (gimp_config_deserialize_property)

2006-08-08  Sven Neumann  <sven@gimp.org>

	* libgimpconfig/gimpconfig-deserialize.c
	(gimp_config_deserialize_property)
	* libgimpconfig/gimpconfig-serialize.c
	(gimp_config_serialize_property): check if the properties
	owner_type is an object type before calling g_type_class_peek().
This commit is contained in:
Sven Neumann 2006-08-08 12:29:48 +00:00 committed by Sven Neumann
parent 29a494d146
commit 44594ae2e0
3 changed files with 56 additions and 42 deletions

View File

@ -1,3 +1,11 @@
2006-08-08 Sven Neumann <sven@gimp.org>
* libgimpconfig/gimpconfig-deserialize.c
(gimp_config_deserialize_property)
* libgimpconfig/gimpconfig-serialize.c
(gimp_config_serialize_property): check if the properties
owner_type is an object type before calling g_type_class_peek().
2006-08-08 Sven Neumann <sven@gimp.org>
* app/tools/gimprectangleoptions.c

View File

@ -212,8 +212,7 @@ gimp_config_deserialize_property (GimpConfig *config,
GScanner *scanner,
gint nest_level)
{
GTypeClass *owner_class;
GimpConfigInterface *config_iface;
GimpConfigInterface *config_iface = NULL;
GimpConfigInterface *parent_iface = NULL;
GParamSpec *prop_spec;
GTokenType token = G_TOKEN_RIGHT_PAREN;
@ -226,28 +225,32 @@ gimp_config_deserialize_property (GimpConfig *config,
g_value_init (&value, prop_spec->value_type);
owner_class = g_type_class_peek (prop_spec->owner_type);
config_iface = g_type_interface_peek (owner_class, GIMP_TYPE_CONFIG);
/* We must call deserialize_property() *only* if the *exact* class
* which implements it is param_spec->owner_type's class.
*
* Therefore, we ask param_spec->owner_type's immediate parent class
* for it's GimpConfigInterface and check if we get a different pointer.
*
* (if the pointers are the same, param_spec->owner_type's
* GimpConfigInterface is inherited from one of it's parent classes
* and thus not able to handle param_spec->owner_type's properties).
*/
if (config_iface)
if (G_TYPE_IS_OBJECT (prop_spec->owner_type))
{
GTypeClass *owner_parent_class;
GTypeClass *owner_class = g_type_class_peek (prop_spec->owner_type);
owner_parent_class = g_type_class_peek_parent (owner_class),
config_iface = g_type_interface_peek (owner_class, GIMP_TYPE_CONFIG);
parent_iface = g_type_interface_peek (owner_parent_class,
GIMP_TYPE_CONFIG);
/* We must call deserialize_property() *only* if the *exact* class
* which implements it is param_spec->owner_type's class.
*
* Therefore, we ask param_spec->owner_type's immediate parent class
* for it's GimpConfigInterface and check if we get a different
* pointer.
*
* (if the pointers are the same, param_spec->owner_type's
* GimpConfigInterface is inherited from one of it's parent classes
* and thus not able to handle param_spec->owner_type's properties).
*/
if (config_iface)
{
GTypeClass *owner_parent_class;
owner_parent_class = g_type_class_peek_parent (owner_class);
parent_iface = g_type_interface_peek (owner_parent_class,
GIMP_TYPE_CONFIG);
}
}
if (config_iface &&

View File

@ -157,8 +157,7 @@ gimp_config_serialize_property (GimpConfig *config,
GParamSpec *param_spec,
GimpConfigWriter *writer)
{
GTypeClass *owner_class;
GimpConfigInterface *config_iface;
GimpConfigInterface *config_iface = NULL;
GimpConfigInterface *parent_iface = NULL;
GValue value = { 0, };
gboolean success = FALSE;
@ -179,28 +178,32 @@ gimp_config_serialize_property (GimpConfig *config,
return TRUE;
}
owner_class = g_type_class_peek (param_spec->owner_type);
config_iface = g_type_interface_peek (owner_class, GIMP_TYPE_CONFIG);
/* We must call serialize_property() *only* if the *exact* class
* which implements it is param_spec->owner_type's class.
*
* Therefore, we ask param_spec->owner_type's immediate parent class
* for it's GimpConfigInterface and check if we get a different pointer.
*
* (if the pointers are the same, param_spec->owner_type's
* GimpConfigInterface is inherited from one of it's parent classes
* and thus not able to handle param_spec->owner_type's properties).
*/
if (config_iface)
if (G_TYPE_IS_OBJECT (param_spec->owner_type))
{
GTypeClass *owner_parent_class;
GTypeClass *owner_class = g_type_class_peek (param_spec->owner_type);
owner_parent_class = g_type_class_peek_parent (owner_class),
config_iface = g_type_interface_peek (owner_class, GIMP_TYPE_CONFIG);
parent_iface = g_type_interface_peek (owner_parent_class,
GIMP_TYPE_CONFIG);
/* We must call serialize_property() *only* if the *exact* class
* which implements it is param_spec->owner_type's class.
*
* Therefore, we ask param_spec->owner_type's immediate parent class
* for it's GimpConfigInterface and check if we get a different
* pointer.
*
* (if the pointers are the same, param_spec->owner_type's
* GimpConfigInterface is inherited from one of it's parent classes
* and thus not able to handle param_spec->owner_type's properties).
*/
if (config_iface)
{
GTypeClass *owner_parent_class;
owner_parent_class = g_type_class_peek_parent (owner_class);
parent_iface = g_type_interface_peek (owner_parent_class,
GIMP_TYPE_CONFIG);
}
}
if (config_iface &&