mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 09:23:24 +00:00
libgimp*: use more g_clear_pointer()
This commit is contained in:
parent
692272e580
commit
c144cf69de
12 changed files with 44 additions and 142 deletions
|
@ -477,14 +477,9 @@ gimp_brush_select_button_finalize (GObject *object)
|
|||
{
|
||||
GimpBrushSelectButtonPrivate *priv = GET_PRIVATE (object);
|
||||
|
||||
g_free (priv->brush_name);
|
||||
priv->brush_name = NULL;
|
||||
|
||||
g_free (priv->mask_data);
|
||||
priv->mask_data = NULL;
|
||||
|
||||
g_free (priv->title);
|
||||
priv->title = NULL;
|
||||
g_clear_pointer (&priv->brush_name, g_free);
|
||||
g_clear_pointer (&priv->mask_data, g_free);
|
||||
g_clear_pointer (&priv->title, g_free);
|
||||
|
||||
G_OBJECT_CLASS (gimp_brush_select_button_parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -273,11 +273,8 @@ gimp_font_select_button_finalize (GObject *object)
|
|||
{
|
||||
GimpFontSelectButtonPrivate *priv = GET_PRIVATE (object);
|
||||
|
||||
g_free (priv->font_name);
|
||||
priv->font_name = NULL;
|
||||
|
||||
g_free (priv->title);
|
||||
priv->title = NULL;
|
||||
g_clear_pointer (&priv->font_name, g_free);
|
||||
g_clear_pointer (&priv->title, g_free);
|
||||
|
||||
G_OBJECT_CLASS (gimp_font_select_button_parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -325,14 +325,9 @@ gimp_gradient_select_button_finalize (GObject *object)
|
|||
{
|
||||
GimpGradientSelectButtonPrivate *priv = GET_PRIVATE (object);
|
||||
|
||||
g_free (priv->gradient_name);
|
||||
priv->gradient_name = NULL;
|
||||
|
||||
g_free (priv->gradient_data);
|
||||
priv->gradient_data = NULL;
|
||||
|
||||
g_free (priv->title);
|
||||
priv->title = NULL;
|
||||
g_clear_pointer (&priv->gradient_name, g_free);
|
||||
g_clear_pointer (&priv->gradient_data, g_free);
|
||||
g_clear_pointer (&priv->title, g_free);
|
||||
|
||||
G_OBJECT_CLASS (gimp_gradient_select_button_parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -292,11 +292,8 @@ gimp_palette_select_button_finalize (GObject *object)
|
|||
|
||||
priv = GIMP_PALETTE_SELECT_BUTTON_GET_PRIVATE (object);
|
||||
|
||||
g_free (priv->palette_name);
|
||||
priv->palette_name = NULL;
|
||||
|
||||
g_free (priv->title);
|
||||
priv->title = NULL;
|
||||
g_clear_pointer (&priv->palette_name, g_free);
|
||||
g_clear_pointer (&priv->title, g_free);
|
||||
|
||||
G_OBJECT_CLASS (gimp_palette_select_button_parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -350,14 +350,9 @@ gimp_pattern_select_button_finalize (GObject *object)
|
|||
|
||||
priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (object);
|
||||
|
||||
g_free (priv->pattern_name);
|
||||
priv->pattern_name = NULL;
|
||||
|
||||
g_free (priv->mask_data);
|
||||
priv->mask_data = NULL;
|
||||
|
||||
g_free (priv->title);
|
||||
priv->title = NULL;
|
||||
g_clear_pointer (&priv->pattern_name, g_free);
|
||||
g_clear_pointer (&priv->mask_data, g_free);
|
||||
g_clear_pointer (&priv->title, g_free);
|
||||
|
||||
G_OBJECT_CLASS (gimp_pattern_select_button_parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -195,6 +195,7 @@ gimp_value_array_unref (GimpValueArray *value_array)
|
|||
if (G_VALUE_TYPE (value) != 0) /* we allow unset values in the array */
|
||||
g_value_unset (value);
|
||||
}
|
||||
|
||||
g_free (value_array->values);
|
||||
g_slice_free (GimpValueArray, value_array);
|
||||
}
|
||||
|
@ -430,13 +431,11 @@ static void
|
|||
gimp_param_value_array_finalize (GParamSpec *pspec)
|
||||
{
|
||||
GimpParamSpecValueArray *aspec = GIMP_PARAM_SPEC_VALUE_ARRAY (pspec);
|
||||
GParamSpecClass *parent_class = g_type_class_peek (g_type_parent (GIMP_TYPE_PARAM_VALUE_ARRAY));
|
||||
GParamSpecClass *parent_class;
|
||||
|
||||
if (aspec->element_spec)
|
||||
{
|
||||
g_param_spec_unref (aspec->element_spec);
|
||||
aspec->element_spec = NULL;
|
||||
}
|
||||
parent_class = g_type_class_peek (g_type_parent (GIMP_TYPE_PARAM_VALUE_ARRAY));
|
||||
|
||||
g_clear_pointer (&aspec->element_spec, g_param_spec_unref);
|
||||
|
||||
parent_class->finalize (pspec);
|
||||
}
|
||||
|
@ -447,7 +446,7 @@ gimp_param_value_array_set_default (GParamSpec *pspec,
|
|||
{
|
||||
GimpParamSpecValueArray *aspec = GIMP_PARAM_SPEC_VALUE_ARRAY (pspec);
|
||||
|
||||
if (!value->data[0].v_pointer && aspec->fixed_n_elements)
|
||||
if (! value->data[0].v_pointer && aspec->fixed_n_elements)
|
||||
value->data[0].v_pointer = gimp_value_array_new (aspec->fixed_n_elements);
|
||||
|
||||
if (value->data[0].v_pointer)
|
||||
|
@ -462,11 +461,11 @@ static gboolean
|
|||
gimp_param_value_array_validate (GParamSpec *pspec,
|
||||
GValue *value)
|
||||
{
|
||||
GimpParamSpecValueArray *aspec = GIMP_PARAM_SPEC_VALUE_ARRAY (pspec);
|
||||
GimpValueArray *value_array = value->data[0].v_pointer;
|
||||
guint changed = 0;
|
||||
GimpParamSpecValueArray *aspec = GIMP_PARAM_SPEC_VALUE_ARRAY (pspec);
|
||||
GimpValueArray *value_array = value->data[0].v_pointer;
|
||||
guint changed = 0;
|
||||
|
||||
if (!value->data[0].v_pointer && aspec->fixed_n_elements)
|
||||
if (! value->data[0].v_pointer && aspec->fixed_n_elements)
|
||||
value->data[0].v_pointer = gimp_value_array_new (aspec->fixed_n_elements);
|
||||
|
||||
if (value->data[0].v_pointer)
|
||||
|
|
|
@ -113,23 +113,9 @@ gimp_module_finalize (GObject *object)
|
|||
{
|
||||
GimpModule *module = GIMP_MODULE (object);
|
||||
|
||||
if (module->info)
|
||||
{
|
||||
gimp_module_info_free (module->info);
|
||||
module->info = NULL;
|
||||
}
|
||||
|
||||
if (module->last_module_error)
|
||||
{
|
||||
g_free (module->last_module_error);
|
||||
module->last_module_error = NULL;
|
||||
}
|
||||
|
||||
if (module->filename)
|
||||
{
|
||||
g_free (module->filename);
|
||||
module->filename = NULL;
|
||||
}
|
||||
g_clear_pointer (&module->info, gimp_module_info_free);
|
||||
g_clear_pointer (&module->last_module_error, g_free);
|
||||
g_clear_pointer (&module->filename, g_free);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -244,31 +244,11 @@ gimp_thumbnail_finalize (GObject *object)
|
|||
{
|
||||
GimpThumbnail *thumbnail = GIMP_THUMBNAIL (object);
|
||||
|
||||
if (thumbnail->image_uri)
|
||||
{
|
||||
g_free (thumbnail->image_uri);
|
||||
thumbnail->image_uri = NULL;
|
||||
}
|
||||
if (thumbnail->image_filename)
|
||||
{
|
||||
g_free (thumbnail->image_filename);
|
||||
thumbnail->image_filename = NULL;
|
||||
}
|
||||
if (thumbnail->image_mimetype)
|
||||
{
|
||||
g_free (thumbnail->image_mimetype);
|
||||
thumbnail->image_mimetype = NULL;
|
||||
}
|
||||
if (thumbnail->image_type)
|
||||
{
|
||||
g_free (thumbnail->image_type);
|
||||
thumbnail->image_type = NULL;
|
||||
}
|
||||
if (thumbnail->thumb_filename)
|
||||
{
|
||||
g_free (thumbnail->thumb_filename);
|
||||
thumbnail->thumb_filename = NULL;
|
||||
}
|
||||
g_clear_pointer (&thumbnail->image_uri, g_free);
|
||||
g_clear_pointer (&thumbnail->image_filename, g_free);
|
||||
g_clear_pointer (&thumbnail->image_mimetype, g_free);
|
||||
g_clear_pointer (&thumbnail->image_type, g_free);
|
||||
g_clear_pointer (&thumbnail->thumb_filename, g_free);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
@ -405,17 +385,8 @@ gimp_thumbnail_set_uri (GimpThumbnail *thumbnail,
|
|||
|
||||
thumbnail->image_uri = g_strdup (uri);
|
||||
|
||||
if (thumbnail->image_filename)
|
||||
{
|
||||
g_free (thumbnail->image_filename);
|
||||
thumbnail->image_filename = NULL;
|
||||
}
|
||||
|
||||
if (thumbnail->thumb_filename)
|
||||
{
|
||||
g_free (thumbnail->thumb_filename);
|
||||
thumbnail->thumb_filename = NULL;
|
||||
}
|
||||
g_clear_pointer (&thumbnail->image_filename, g_free);
|
||||
g_clear_pointer (&thumbnail->thumb_filename, g_free);
|
||||
|
||||
thumbnail->thumb_size = -1;
|
||||
thumbnail->thumb_filesize = 0;
|
||||
|
|
|
@ -133,17 +133,8 @@ gimp_controller_finalize (GObject *object)
|
|||
{
|
||||
GimpController *controller = GIMP_CONTROLLER (object);
|
||||
|
||||
if (controller->name)
|
||||
{
|
||||
g_free (controller->name);
|
||||
controller->name = NULL;
|
||||
}
|
||||
|
||||
if (controller->state)
|
||||
{
|
||||
g_free (controller->state);
|
||||
controller->state = NULL;
|
||||
}
|
||||
g_clear_pointer (&controller->name, g_free);
|
||||
g_clear_pointer (&controller->state, g_free);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -122,11 +122,7 @@ gimp_enum_label_finalize (GObject *object)
|
|||
{
|
||||
GimpEnumLabelPrivate *private = GET_PRIVATE (object);
|
||||
|
||||
if (private->enum_class)
|
||||
{
|
||||
g_type_class_unref (private->enum_class);
|
||||
private->enum_class = NULL;
|
||||
}
|
||||
g_clear_pointer (&private->enum_class, g_type_class_unref);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -347,18 +347,10 @@ gimp_number_pair_entry_finalize (GObject *object)
|
|||
{
|
||||
GimpNumberPairEntryPrivate *priv = GET_PRIVATE (object);
|
||||
|
||||
if (priv->separators)
|
||||
{
|
||||
g_free (priv->separators);
|
||||
priv->separators = NULL;
|
||||
priv->num_separators = 0;
|
||||
}
|
||||
g_clear_pointer (&priv->separators, g_free);
|
||||
priv->num_separators = 0;
|
||||
|
||||
if (priv->default_text)
|
||||
{
|
||||
g_free (priv->default_text);
|
||||
priv->default_text = NULL;
|
||||
}
|
||||
g_clear_pointer (&priv->default_text, g_free);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -219,24 +219,12 @@ gimp_unit_store_finalize (GObject *object)
|
|||
{
|
||||
GimpUnitStorePrivate *private = GET_PRIVATE (object);
|
||||
|
||||
if (private->short_format)
|
||||
{
|
||||
g_free (private->short_format);
|
||||
private->short_format = NULL;
|
||||
}
|
||||
g_clear_pointer (&private->short_format, g_free);
|
||||
g_clear_pointer (&private->long_format, g_free);
|
||||
|
||||
if (private->long_format)
|
||||
{
|
||||
g_free (private->long_format);
|
||||
private->long_format = NULL;
|
||||
}
|
||||
|
||||
if (private->num_values > 0)
|
||||
{
|
||||
g_free (private->values);
|
||||
g_free (private->resolutions);
|
||||
private->num_values = 0;
|
||||
}
|
||||
g_clear_pointer (&private->values, g_free);
|
||||
g_clear_pointer (&private->resolutions, g_free);
|
||||
private->num_values = 0;
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue