app: use a lot of g_clear_object() and g_clear_pointer()

More than 2000 lines of code less in app/, instead of

if (instance->member)
  {
    g_object_unref/g_free/g_whatever (instance->member);
    instance->member = NULL;
  }

we now simply use

g_clear_object/pointer (&instance->member);
This commit is contained in:
Michael Natterer 2017-07-15 18:38:01 +02:00
parent f3561549bb
commit 0cb3e75f79
174 changed files with 676 additions and 2857 deletions

View File

@ -270,8 +270,7 @@ actions_exit (Gimp *gimp)
g_return_if_fail (global_action_factory != NULL);
g_return_if_fail (global_action_factory->gimp == gimp);
g_object_unref (global_action_factory);
global_action_factory = NULL;
g_clear_object (&global_action_factory);
}
Gimp *

View File

@ -726,14 +726,9 @@ gimp_core_config_finalize (GObject *object)
g_free (core_config->plug_in_rc_path);
g_free (core_config->import_raw_plug_in);
if (core_config->default_image)
g_object_unref (core_config->default_image);
if (core_config->default_grid)
g_object_unref (core_config->default_grid);
if (core_config->color_management)
g_object_unref (core_config->color_management);
g_clear_object (&core_config->default_image);
g_clear_object (&core_config->default_grid);
g_clear_object (&core_config->color_management);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -558,35 +558,12 @@ gimp_dialog_config_finalize (GObject *object)
{
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (object);
if (config->layer_new_name)
{
g_free (config->layer_new_name);
config->layer_new_name = NULL;
}
g_clear_pointer (&config->layer_new_name, g_free);
g_clear_pointer (&config->channel_new_name, g_free);
g_clear_pointer (&config->vectors_new_name, g_free);
if (config->channel_new_name)
{
g_free (config->channel_new_name);
config->channel_new_name = NULL;
}
if (config->vectors_new_name)
{
g_free (config->vectors_new_name);
config->vectors_new_name = NULL;
}
if (config->fill_options)
{
g_object_unref (config->fill_options);
config->fill_options = NULL;
}
if (config->stroke_options)
{
g_object_unref (config->stroke_options);
config->stroke_options = NULL;
}
g_clear_object (&config->fill_options);
g_clear_object (&config->stroke_options);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -367,11 +367,8 @@ gimp_display_config_finalize (GObject *object)
g_free (display_config->image_title_format);
g_free (display_config->image_status_format);
if (display_config->default_view)
g_object_unref (display_config->default_view);
if (display_config->default_fullscreen_view)
g_object_unref (display_config->default_fullscreen_view);
g_clear_object (&display_config->default_view);
g_clear_object (&display_config->default_fullscreen_view);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -130,17 +130,8 @@ gimp_rc_finalize (GObject *object)
{
GimpRc *rc = GIMP_RC (object);
if (rc->system_gimprc)
{
g_object_unref (rc->system_gimprc);
rc->system_gimprc = NULL;
}
if (rc->user_gimprc)
{
g_object_unref (rc->user_gimprc);
rc->user_gimprc = NULL;
}
g_clear_object (&rc->system_gimprc);
g_clear_object (&rc->user_gimprc);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -250,53 +250,14 @@ gimp_data_factories_exit (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
if (gimp->brush_factory)
{
g_object_unref (gimp->brush_factory);
gimp->brush_factory = NULL;
}
if (gimp->dynamics_factory)
{
g_object_unref (gimp->dynamics_factory);
gimp->dynamics_factory = NULL;
}
if (gimp->mybrush_factory)
{
g_object_unref (gimp->mybrush_factory);
gimp->mybrush_factory = NULL;
}
if (gimp->pattern_factory)
{
g_object_unref (gimp->pattern_factory);
gimp->pattern_factory = NULL;
}
if (gimp->gradient_factory)
{
g_object_unref (gimp->gradient_factory);
gimp->gradient_factory = NULL;
}
if (gimp->palette_factory)
{
g_object_unref (gimp->palette_factory);
gimp->palette_factory = NULL;
}
if (gimp->tool_preset_factory)
{
g_object_unref (gimp->tool_preset_factory);
gimp->tool_preset_factory = NULL;
}
if (gimp->tag_cache)
{
g_object_unref (gimp->tag_cache);
gimp->tag_cache = NULL;
}
g_clear_object (&gimp->brush_factory);
g_clear_object (&gimp->dynamics_factory);
g_clear_object (&gimp->mybrush_factory);
g_clear_object (&gimp->pattern_factory);
g_clear_object (&gimp->gradient_factory);
g_clear_object (&gimp->palette_factory);
g_clear_object (&gimp->tool_preset_factory);
g_clear_object (&gimp->tag_cache);
}
gint64

View File

@ -53,11 +53,7 @@ gimp_modules_exit (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
if (gimp->module_db)
{
g_object_unref (gimp->module_db);
gimp->module_db = NULL;
}
g_clear_object (&gimp->module_db);
}
void

View File

@ -343,25 +343,12 @@ gimp_dispose (GObject *object)
gimp_filter_history_clear (gimp);
if (gimp->edit_config)
{
g_object_unref (gimp->edit_config);
gimp->edit_config = NULL;
}
if (gimp->config)
{
g_object_unref (gimp->config);
gimp->config = NULL;
}
g_clear_object (&gimp->edit_config);
g_clear_object (&gimp->config);
gimp_contexts_exit (gimp);
if (gimp->image_new_last_template)
{
g_object_unref (gimp->image_new_last_template);
gimp->image_new_last_template = NULL;
}
g_clear_object (&gimp->image_new_last_template);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@ -388,17 +375,8 @@ gimp_finalize (GObject *object)
standards = g_list_prepend (standards,
gimp_palette_get_standard (gimp->user_context));
if (gimp->templates)
{
g_object_unref (gimp->templates);
gimp->templates = NULL;
}
if (gimp->documents)
{
g_object_unref (gimp->documents);
gimp->documents = NULL;
}
g_clear_object (&gimp->templates);
g_clear_object (&gimp->documents);
gimp_tool_info_set_standard (gimp, NULL);
@ -406,92 +384,35 @@ gimp_finalize (GObject *object)
{
gimp_container_foreach (gimp->tool_info_list,
(GFunc) g_object_run_dispose, NULL);
g_object_unref (gimp->tool_info_list);
gimp->tool_info_list = NULL;
g_clear_object (&gimp->tool_info_list);
}
xcf_exit (gimp);
if (gimp->pdb)
{
g_object_unref (gimp->pdb);
gimp->pdb = NULL;
}
g_clear_object (&gimp->pdb);
gimp_data_factories_exit (gimp);
gimp_fonts_exit (gimp);
if (gimp->named_buffers)
{
g_object_unref (gimp->named_buffers);
gimp->named_buffers = NULL;
}
if (gimp->clipboard_buffer)
{
g_object_unref (gimp->clipboard_buffer);
gimp->clipboard_buffer = NULL;
}
if (gimp->clipboard_image)
{
g_object_unref (gimp->clipboard_image);
gimp->clipboard_image = NULL;
}
if (gimp->displays)
{
g_object_unref (gimp->displays);
gimp->displays = NULL;
}
if (gimp->item_table)
{
g_object_unref (gimp->item_table);
gimp->item_table = NULL;
}
if (gimp->image_table)
{
g_object_unref (gimp->image_table);
gimp->image_table = NULL;
}
if (gimp->images)
{
g_object_unref (gimp->images);
gimp->images = NULL;
}
if (gimp->plug_in_manager)
{
g_object_unref (gimp->plug_in_manager);
gimp->plug_in_manager = NULL;
}
g_clear_object (&gimp->named_buffers);
g_clear_object (&gimp->clipboard_buffer);
g_clear_object (&gimp->clipboard_image);
g_clear_object (&gimp->displays);
g_clear_object (&gimp->item_table);
g_clear_object (&gimp->image_table);
g_clear_object (&gimp->images);
g_clear_object (&gimp->plug_in_manager);
if (gimp->module_db)
gimp_modules_exit (gimp);
gimp_paint_exit (gimp);
if (gimp->parasites)
{
g_object_unref (gimp->parasites);
gimp->parasites = NULL;
}
g_clear_object (&gimp->parasites);
g_clear_object (&gimp->default_folder);
if (gimp->default_folder)
{
g_object_unref (gimp->default_folder);
gimp->default_folder = NULL;
}
if (gimp->session_name)
{
g_free (gimp->session_name);
gimp->session_name = NULL;
}
g_clear_pointer (&gimp->session_name, g_free);
if (gimp->context_list)
{
@ -1005,14 +926,8 @@ gimp_set_clipboard_image (Gimp *gimp,
if (image)
g_object_ref (image);
if (gimp->clipboard_buffer)
{
g_object_unref (gimp->clipboard_buffer);
gimp->clipboard_buffer = NULL;
}
if (gimp->clipboard_image)
g_object_unref (gimp->clipboard_image);
g_clear_object (&gimp->clipboard_buffer);
g_clear_object (&gimp->clipboard_image);
gimp->clipboard_image = image;
@ -1038,14 +953,8 @@ gimp_set_clipboard_buffer (Gimp *gimp,
if (buffer)
g_object_ref (buffer);
if (gimp->clipboard_image)
{
g_object_unref (gimp->clipboard_image);
gimp->clipboard_image = NULL;
}
if (gimp->clipboard_buffer)
g_object_unref (gimp->clipboard_buffer);
g_clear_object (&gimp->clipboard_image);
g_clear_object (&gimp->clipboard_buffer);
gimp->clipboard_buffer = buffer;

View File

@ -182,46 +182,14 @@ gimp_brush_finalize (GObject *object)
{
GimpBrush *brush = GIMP_BRUSH (object);
if (brush->priv->mask)
{
gimp_temp_buf_unref (brush->priv->mask);
brush->priv->mask = NULL;
}
g_clear_pointer (&brush->priv->mask, gimp_temp_buf_unref);
g_clear_pointer (&brush->priv->pixmap, gimp_temp_buf_unref);
g_clear_pointer (&brush->priv->blured_mask, gimp_temp_buf_unref);
g_clear_pointer (&brush->priv->blured_pixmap, gimp_temp_buf_unref);
if (brush->priv->pixmap)
{
gimp_temp_buf_unref (brush->priv->pixmap);
brush->priv->pixmap = NULL;
}
if (brush->priv->blured_mask)
{
gimp_temp_buf_unref (brush->priv->blured_mask);
brush->priv->blured_mask = NULL;
}
if (brush->priv->blured_pixmap)
{
gimp_temp_buf_unref (brush->priv->blured_pixmap);
brush->priv->blured_pixmap = NULL;
}
if (brush->priv->mask_cache)
{
g_object_unref (brush->priv->mask_cache);
brush->priv->mask_cache = NULL;
}
if (brush->priv->pixmap_cache)
{
g_object_unref (brush->priv->pixmap_cache);
brush->priv->pixmap_cache = NULL;
}
if (brush->priv->boundary_cache)
{
g_object_unref (brush->priv->boundary_cache);
brush->priv->boundary_cache = NULL;
}
g_clear_object (&brush->priv->mask_cache);
g_clear_object (&brush->priv->pixmap_cache);
g_clear_object (&brush->priv->boundary_cache);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -429,17 +397,8 @@ gimp_brush_dirty (GimpData *data)
if (brush->priv->boundary_cache)
gimp_brush_cache_clear (brush->priv->boundary_cache);
if (brush->priv->blured_mask)
{
gimp_temp_buf_unref (brush->priv->blured_mask);
brush->priv->blured_mask = NULL;
}
if (brush->priv->blured_pixmap)
{
gimp_temp_buf_unref (brush->priv->blured_pixmap);
brush->priv->blured_pixmap = NULL;
}
g_clear_pointer (&brush->priv->blured_mask, gimp_temp_buf_unref);
g_clear_pointer (&brush->priv->blured_pixmap, gimp_temp_buf_unref);
GIMP_DATA_CLASS (parent_class)->dirty (data);
}
@ -466,26 +425,12 @@ gimp_brush_real_begin_use (GimpBrush *brush)
static void
gimp_brush_real_end_use (GimpBrush *brush)
{
g_object_unref (brush->priv->mask_cache);
brush->priv->mask_cache = NULL;
g_clear_object (&brush->priv->mask_cache);
g_clear_object (&brush->priv->pixmap_cache);
g_clear_object (&brush->priv->boundary_cache);
g_object_unref (brush->priv->pixmap_cache);
brush->priv->pixmap_cache = NULL;
g_object_unref (brush->priv->boundary_cache);
brush->priv->boundary_cache = NULL;
if (brush->priv->blured_mask)
{
gimp_temp_buf_unref (brush->priv->blured_mask);
brush->priv->blured_mask = NULL;
}
if (brush->priv->blured_pixmap)
{
gimp_temp_buf_unref (brush->priv->blured_pixmap);
brush->priv->blured_pixmap = NULL;
}
g_clear_pointer (&brush->priv->blured_mask, gimp_temp_buf_unref);
g_clear_pointer (&brush->priv->blured_pixmap, gimp_temp_buf_unref);
}
static GimpBrush *
@ -911,17 +856,8 @@ void
gimp_brush_flush_blur_caches (GimpBrush *brush)
{
#if 0
if (brush->priv->blured_mask)
{
gimp_temp_buf_unref (brush->priv->blured_mask);
brush->priv->blured_mask = NULL;
}
if (brush->priv->blured_pixmap)
{
gimp_temp_buf_unref (brush->priv->blured_pixmap);
brush->priv->blured_pixmap = NULL;
}
g_clear_pointer (&brush->priv->blured_mask, gimp_temp_buf_unref);
g_clear_pointer (&brush->priv->blured_pixmap, gimp_temp_buf_unref);
if (brush->priv->mask_cache)
gimp_brush_cache_clear (brush->priv->mask_cache);
@ -946,14 +882,13 @@ gint
gimp_brush_get_width (GimpBrush *brush)
{
g_return_val_if_fail (GIMP_IS_BRUSH (brush), 0);
if (brush->priv->blured_mask)
{
return gimp_temp_buf_get_width (brush->priv->blured_mask);
}
return gimp_temp_buf_get_width (brush->priv->blured_mask);
if (brush->priv->blured_pixmap)
{
return gimp_temp_buf_get_width (brush->priv->blured_pixmap);
}
return gimp_temp_buf_get_width (brush->priv->blured_pixmap);
return gimp_temp_buf_get_width (brush->priv->mask);
}
@ -963,14 +898,11 @@ gimp_brush_get_height (GimpBrush *brush)
g_return_val_if_fail (GIMP_IS_BRUSH (brush), 0);
if (brush->priv->blured_mask)
{
return gimp_temp_buf_get_height (brush->priv->blured_mask);
}
if (brush->priv->blured_pixmap)
{
return gimp_temp_buf_get_height (brush->priv->blured_pixmap);
}
return gimp_temp_buf_get_height (brush->priv->mask);
}

View File

@ -210,17 +210,8 @@ gimp_brush_clipboard_changed (Gimp *gimp,
gint width;
gint height;
if (brush->priv->mask)
{
gimp_temp_buf_unref (brush->priv->mask);
brush->priv->mask = NULL;
}
if (brush->priv->pixmap)
{
gimp_temp_buf_unref (brush->priv->pixmap);
brush->priv->pixmap = NULL;
}
g_clear_pointer (&brush->priv->mask, gimp_temp_buf_unref);
g_clear_pointer (&brush->priv->pixmap, gimp_temp_buf_unref);
paste = gimp_get_clipboard_object (gimp);

View File

@ -254,8 +254,7 @@ gimp_brush_generated_dirty (GimpData *data)
GimpBrushGenerated *brush = GIMP_BRUSH_GENERATED (data);
GimpBrush *gbrush = GIMP_BRUSH (brush);
if (gbrush->priv->mask)
gimp_temp_buf_unref (gbrush->priv->mask);
g_clear_pointer (&gbrush->priv->mask, gimp_temp_buf_unref);
gbrush->priv->mask = gimp_brush_generated_calc (brush,
brush->shape,

View File

@ -123,11 +123,7 @@ gimp_buffer_finalize (GObject *object)
{
GimpBuffer *buffer = GIMP_BUFFER (object);
if (buffer->buffer)
{
g_object_unref (buffer->buffer);
buffer->buffer = NULL;
}
g_clear_object (&buffer->buffer);
gimp_buffer_set_color_profile (buffer, NULL);
@ -528,16 +524,10 @@ gimp_buffer_set_color_profile (GimpBuffer *buffer,
if (profile != buffer->color_profile)
{
if (buffer->color_profile)
{
g_object_unref (buffer->color_profile);
buffer->color_profile = NULL;
}
g_clear_object (&buffer->color_profile);
if (profile)
{
buffer->color_profile = g_object_ref (profile);
}
buffer->color_profile = g_object_ref (profile);
}
}

View File

@ -968,83 +968,19 @@ gimp_context_dispose (GObject *object)
context->gimp = NULL;
}
if (context->tool_info)
{
g_object_unref (context->tool_info);
context->tool_info = NULL;
}
if (context->paint_info)
{
g_object_unref (context->paint_info);
context->paint_info = NULL;
}
if (context->brush)
{
g_object_unref (context->brush);
context->brush = NULL;
}
if (context->dynamics)
{
g_object_unref (context->dynamics);
context->dynamics = NULL;
}
if (context->mybrush)
{
g_object_unref (context->mybrush);
context->mybrush = NULL;
}
if (context->pattern)
{
g_object_unref (context->pattern);
context->pattern = NULL;
}
if (context->gradient)
{
g_object_unref (context->gradient);
context->gradient = NULL;
}
if (context->palette)
{
g_object_unref (context->palette);
context->palette = NULL;
}
if (context->tool_preset)
{
g_object_unref (context->tool_preset);
context->tool_preset = NULL;
}
if (context->font)
{
g_object_unref (context->font);
context->font = NULL;
}
if (context->buffer)
{
g_object_unref (context->buffer);
context->buffer = NULL;
}
if (context->imagefile)
{
g_object_unref (context->imagefile);
context->imagefile = NULL;
}
if (context->template)
{
g_object_unref (context->template);
context->template = NULL;
}
g_clear_object (&context->tool_info);
g_clear_object (&context->paint_info);
g_clear_object (&context->brush);
g_clear_object (&context->dynamics);
g_clear_object (&context->mybrush);
g_clear_object (&context->pattern);
g_clear_object (&context->gradient);
g_clear_object (&context->palette);
g_clear_object (&context->tool_preset);
g_clear_object (&context->font);
g_clear_object (&context->buffer);
g_clear_object (&context->imagefile);
g_clear_object (&context->template);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@ -1058,83 +994,19 @@ gimp_context_finalize (GObject *object)
context->image = NULL;
context->display = NULL;
if (context->tool_name)
{
g_free (context->tool_name);
context->tool_name = NULL;
}
if (context->paint_name)
{
g_free (context->paint_name);
context->paint_name = NULL;
}
if (context->brush_name)
{
g_free (context->brush_name);
context->brush_name = NULL;
}
if (context->dynamics_name)
{
g_free (context->dynamics_name);
context->dynamics_name = NULL;
}
if (context->mybrush_name)
{
g_free (context->mybrush_name);
context->mybrush_name = NULL;
}
if (context->pattern_name)
{
g_free (context->pattern_name);
context->pattern_name = NULL;
}
if (context->gradient_name)
{
g_free (context->gradient_name);
context->gradient_name = NULL;
}
if (context->palette_name)
{
g_free (context->palette_name);
context->palette_name = NULL;
}
if (context->tool_preset_name)
{
g_free (context->tool_preset_name);
context->tool_preset_name = NULL;
}
if (context->font_name)
{
g_free (context->font_name);
context->font_name = NULL;
}
if (context->buffer_name)
{
g_free (context->buffer_name);
context->buffer_name = NULL;
}
if (context->imagefile_name)
{
g_free (context->imagefile_name);
context->imagefile_name = NULL;
}
if (context->template_name)
{
g_free (context->template_name);
context->template_name = NULL;
}
g_clear_pointer (&context->tool_name, g_free);
g_clear_pointer (&context->paint_name, g_free);
g_clear_pointer (&context->brush_name, g_free);
g_clear_pointer (&context->dynamics_name, g_free);
g_clear_pointer (&context->mybrush_name, g_free);
g_clear_pointer (&context->pattern_name, g_free);
g_clear_pointer (&context->gradient_name, g_free);
g_clear_pointer (&context->palette_name, g_free);
g_clear_pointer (&context->tool_preset_name, g_free);
g_clear_pointer (&context->font_name, g_free);
g_clear_pointer (&context->buffer_name, g_free);
g_clear_pointer (&context->imagefile_name, g_free);
g_clear_pointer (&context->template_name, g_free);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -254,11 +254,7 @@ gimp_data_finalize (GObject *object)
{
GimpDataPrivate *private = GIMP_DATA_GET_PRIVATE (object);
if (private->file)
{
g_object_unref (private->file);
private->file = NULL;
}
g_clear_object (&private->file);
if (private->tags)
{
@ -266,11 +262,7 @@ gimp_data_finalize (GObject *object)
private->tags = NULL;
}
if (private->identifier)
{
g_free (private->identifier);
private->identifier = NULL;
}
g_clear_pointer (&private->identifier, g_free);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -1106,11 +1098,7 @@ gimp_data_duplicate (GimpData *data)
"deletable", TRUE,
NULL);
if (private->file)
{
g_object_unref (private->file);
private->file = NULL;
}
g_clear_object (&private->file);
return new;
}
@ -1140,11 +1128,7 @@ gimp_data_make_internal (GimpData *data,
private = GIMP_DATA_GET_PRIVATE (data);
if (private->file)
{
g_object_unref (private->file);
private->file = NULL;
}
g_clear_object (&private->file);
private->identifier = g_strdup (identifier);
private->writable = FALSE;

View File

@ -144,29 +144,11 @@ gimp_data_factory_finalize (GObject *object)
{
GimpDataFactory *factory = GIMP_DATA_FACTORY (object);
if (factory->priv->container)
{
g_object_unref (factory->priv->container);
factory->priv->container = NULL;
}
g_clear_object (&factory->priv->container);
g_clear_object (&factory->priv->container_obsolete);
if (factory->priv->container_obsolete)
{
g_object_unref (factory->priv->container_obsolete);
factory->priv->container_obsolete = NULL;
}
if (factory->priv->path_property_name)
{
g_free (factory->priv->path_property_name);
factory->priv->path_property_name = NULL;
}
if (factory->priv->writable_property_name)
{
g_free (factory->priv->writable_property_name);
factory->priv->writable_property_name = NULL;
}
g_clear_pointer (&factory->priv->path_property_name, g_free);
g_clear_pointer (&factory->priv->writable_property_name, g_free);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -372,7 +354,7 @@ gimp_data_factory_data_load (GimpDataFactory *factory,
list->data);
}
g_list_free_full (path, (GDestroyNotify) g_object_unref);
g_list_free_full (path, (GDestroyNotify) g_object_unref);
g_list_free_full (writable_path, (GDestroyNotify) g_object_unref);
}
@ -789,7 +771,7 @@ gimp_data_factory_get_save_dir (GimpDataFactory *factory,
_("You don't have any writable data folder configured."));
}
g_list_free_full (path, (GDestroyNotify) g_object_unref);
g_list_free_full (path, (GDestroyNotify) g_object_unref);
g_list_free_full (writable_path, (GDestroyNotify) g_object_unref);
return writable_dir;

View File

@ -254,11 +254,8 @@ gimp_drawable_remove_fs_filter (GimpDrawable *drawable)
fs->layer_offset_node, "input");
}
g_object_unref (private->fs_filter);
private->fs_filter = NULL;
g_object_unref (private->fs_applicator);
private->fs_applicator = NULL;
g_clear_object (&private->fs_filter);
g_clear_object (&private->fs_applicator);
private->fs_crop_node = NULL;
}

View File

@ -71,11 +71,7 @@ gimp_drawable_free_shadow_buffer (GimpDrawable *drawable)
{
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
if (drawable->private->shadow)
{
g_object_unref (drawable->private->shadow);
drawable->private->shadow = NULL;
}
g_clear_object (&drawable->private->shadow);
}
void

View File

@ -312,25 +312,12 @@ gimp_drawable_finalize (GObject *object)
{
GimpDrawable *drawable = GIMP_DRAWABLE (object);
if (drawable->private->buffer)
{
g_object_unref (drawable->private->buffer);
drawable->private->buffer = NULL;
}
g_clear_object (&drawable->private->buffer);
gimp_drawable_free_shadow_buffer (drawable);
if (drawable->private->source_node)
{
g_object_unref (drawable->private->source_node);
drawable->private->source_node = NULL;
}
if (drawable->private->filter_stack)
{
g_object_unref (drawable->private->filter_stack);
drawable->private->filter_stack = NULL;
}
g_clear_object (&drawable->private->source_node);
g_clear_object (&drawable->private->filter_stack);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -173,23 +173,9 @@ gimp_drawable_filter_finalize (GObject *object)
{
GimpDrawableFilter *drawable_filter = GIMP_DRAWABLE_FILTER (object);
if (drawable_filter->operation)
{
g_object_unref (drawable_filter->operation);
drawable_filter->operation = NULL;
}
if (drawable_filter->applicator)
{
g_object_unref (drawable_filter->applicator);
drawable_filter->applicator = NULL;
}
if (drawable_filter->drawable)
{
g_object_unref (drawable_filter->drawable);
drawable_filter->drawable = NULL;
}
g_clear_object (&drawable_filter->operation);
g_clear_object (&drawable_filter->applicator);
g_clear_object (&drawable_filter->drawable);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -208,11 +208,7 @@ gimp_drawable_mod_undo_free (GimpUndo *undo,
{
GimpDrawableModUndo *drawable_mod_undo = GIMP_DRAWABLE_MOD_UNDO (undo);
if (drawable_mod_undo->buffer)
{
g_object_unref (drawable_mod_undo->buffer);
drawable_mod_undo->buffer = NULL;
}
g_clear_object (&drawable_mod_undo->buffer);
GIMP_UNDO_CLASS (parent_class)->free (undo, undo_mode);
}

View File

@ -201,17 +201,8 @@ gimp_drawable_undo_free (GimpUndo *undo,
{
GimpDrawableUndo *drawable_undo = GIMP_DRAWABLE_UNDO (undo);
if (drawable_undo->buffer)
{
g_object_unref (drawable_undo->buffer);
drawable_undo->buffer = NULL;
}
if (drawable_undo->applied_buffer)
{
g_object_unref (drawable_undo->applied_buffer);
drawable_undo->applied_buffer = NULL;
}
g_clear_object (&drawable_undo->buffer);
g_clear_object (&drawable_undo->applied_buffer);
GIMP_UNDO_CLASS (parent_class)->free (undo, undo_mode);
}

View File

@ -270,17 +270,17 @@ gimp_dynamics_finalize (GObject *object)
{
GimpDynamicsPrivate *private = GET_PRIVATE (object);
g_object_unref (private->opacity_output);
g_object_unref (private->force_output);
g_object_unref (private->hardness_output);
g_object_unref (private->rate_output);
g_object_unref (private->flow_output);
g_object_unref (private->size_output);
g_object_unref (private->aspect_ratio_output);
g_object_unref (private->color_output);
g_object_unref (private->angle_output);
g_object_unref (private->jitter_output);
g_object_unref (private->spacing_output);
g_clear_object (&private->opacity_output);
g_clear_object (&private->force_output);
g_clear_object (&private->hardness_output);
g_clear_object (&private->rate_output);
g_clear_object (&private->flow_output);
g_clear_object (&private->size_output);
g_clear_object (&private->aspect_ratio_output);
g_clear_object (&private->color_output);
g_clear_object (&private->angle_output);
g_clear_object (&private->jitter_output);
g_clear_object (&private->spacing_output);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -252,13 +252,13 @@ gimp_dynamics_output_finalize (GObject *object)
{
GimpDynamicsOutputPrivate *private = GET_PRIVATE (object);
g_object_unref (private->pressure_curve);
g_object_unref (private->velocity_curve);
g_object_unref (private->direction_curve);
g_object_unref (private->tilt_curve);
g_object_unref (private->wheel_curve);
g_object_unref (private->random_curve);
g_object_unref (private->fade_curve);
g_clear_object (&private->pressure_curve);
g_clear_object (&private->velocity_curve);
g_clear_object (&private->direction_curve);
g_clear_object (&private->tilt_curve);
g_clear_object (&private->wheel_curve);
g_clear_object (&private->random_curve);
g_clear_object (&private->fade_curve);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -138,11 +138,7 @@ gimp_filter_finalize (GObject *object)
{
GimpFilterPrivate *private = GET_PRIVATE (object);
if (private->node)
{
g_object_unref (private->node);
private->node = NULL;
}
g_clear_object (&private->node);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -168,11 +168,7 @@ gimp_filtered_container_finalize (GObject *object)
{
GimpFilteredContainer *filtered_container = GIMP_FILTERED_CONTAINER (object);
if (filtered_container->src_container)
{
g_object_unref (filtered_container->src_container);
filtered_container->src_container = NULL;
}
g_clear_object (&filtered_container->src_container);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -96,11 +96,7 @@ gimp_filter_stack_finalize (GObject *object)
{
GimpFilterStack *stack = GIMP_FILTER_STACK (object);
if (stack->graph)
{
g_object_unref (stack->graph);
stack->graph = NULL;
}
g_clear_object (&stack->graph);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -311,21 +311,11 @@ gimp_group_layer_finalize (GObject *object)
gimp_group_layer_stack_update,
object);
g_object_unref (private->children);
private->children = NULL;
g_clear_object (&private->children);
}
if (private->projection)
{
g_object_unref (private->projection);
private->projection = NULL;
}
if (private->graph)
{
g_object_unref (private->graph);
private->graph = NULL;
}
g_clear_object (&private->projection);
g_clear_object (&private->graph);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -181,11 +181,7 @@ gimp_guide_undo_free (GimpUndo *undo,
{
GimpGuideUndo *guide_undo = GIMP_GUIDE_UNDO (undo);
if (guide_undo->guide)
{
g_object_unref (guide_undo->guide);
guide_undo->guide = NULL;
}
g_clear_object (&guide_undo->guide);
GIMP_UNDO_CLASS (parent_class)->free (undo, undo_mode);
}

View File

@ -81,11 +81,7 @@ gimp_id_table_finalize (GObject *object)
{
GimpIdTable *id_table = GIMP_ID_TABLE (object);
if (id_table->priv->id_table)
{
g_hash_table_unref (id_table->priv->id_table);
id_table->priv->id_table = NULL;
}
g_clear_pointer (&id_table->priv->id_table, g_hash_table_unref);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -628,11 +628,7 @@ _gimp_image_free_color_profile (GimpImage *image)
{
GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
if (private->color_profile)
{
g_object_unref (private->color_profile);
private->color_profile = NULL;
}
g_clear_object (&private->color_profile);
_gimp_image_free_color_transforms (image);
}
@ -642,29 +638,10 @@ _gimp_image_free_color_transforms (GimpImage *image)
{
GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
if (private->transform_to_srgb_u8)
{
g_object_unref (private->transform_to_srgb_u8);
private->transform_to_srgb_u8 = NULL;
}
if (private->transform_from_srgb_u8)
{
g_object_unref (private->transform_from_srgb_u8);
private->transform_from_srgb_u8 = NULL;
}
if (private->transform_to_srgb_double)
{
g_object_unref (private->transform_to_srgb_double);
private->transform_to_srgb_double = NULL;
}
if (private->transform_from_srgb_double)
{
g_object_unref (private->transform_from_srgb_double);
private->transform_from_srgb_double = NULL;
}
g_clear_object (&private->transform_to_srgb_u8);
g_clear_object (&private->transform_from_srgb_u8);
g_clear_object (&private->transform_to_srgb_double);
g_clear_object (&private->transform_from_srgb_double);
private->color_transforms_created = FALSE;
}

View File

@ -126,11 +126,8 @@ gimp_image_colormap_free (GimpImage *image)
g_return_if_fail (private->colormap != NULL);
g_return_if_fail (GIMP_IS_PALETTE (private->palette));
g_free (private->colormap);
private->colormap = NULL;
g_object_unref (private->palette);
private->palette = NULL;
g_clear_pointer (&private->colormap, g_free);
g_clear_object (&private->palette);
/* don't touch the image's babl_palettes because we might still have
* buffers with that palette on the undo stack, and on undoing the

View File

@ -1027,18 +1027,9 @@ gimp_image_finalize (GObject *object)
GimpImage *image = GIMP_IMAGE (object);
GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
if (private->projection)
{
g_object_unref (private->projection);
private->projection = NULL;
}
if (private->graph)
{
g_object_unref (private->graph);
private->graph = NULL;
private->visible_mask = NULL;
}
g_clear_object (&private->projection);
g_clear_object (&private->graph);
private->visible_mask = NULL;
if (private->colormap)
gimp_image_colormap_free (image);
@ -1046,74 +1037,24 @@ gimp_image_finalize (GObject *object)
if (private->color_profile)
_gimp_image_free_color_profile (image);
if (private->metadata)
{
g_object_unref (private->metadata);
private->metadata = NULL;
}
g_clear_object (&private->metadata);
g_clear_object (&private->file);
g_clear_object (&private->imported_file);
g_clear_object (&private->exported_file);
g_clear_object (&private->save_a_copy_file);
g_clear_object (&private->untitled_file);
g_clear_object (&private->layers);
g_clear_object (&private->channels);
g_clear_object (&private->vectors);
if (private->file)
{
g_object_unref (private->file);
private->file = NULL;
}
if (private->imported_file)
{
g_object_unref (private->imported_file);
private->imported_file = NULL;
}
if (private->exported_file)
{
g_object_unref (private->exported_file);
private->exported_file = NULL;
}
if (private->save_a_copy_file)
{
g_object_unref (private->save_a_copy_file);
private->save_a_copy_file = NULL;
}
if (private->untitled_file)
{
g_object_unref (private->untitled_file);
private->untitled_file = NULL;
}
if (private->layers)
{
g_object_unref (private->layers);
private->layers = NULL;
}
if (private->channels)
{
g_object_unref (private->channels);
private->channels = NULL;
}
if (private->vectors)
{
g_object_unref (private->vectors);
private->vectors = NULL;
}
if (private->layer_stack)
{
g_slist_free (private->layer_stack);
private->layer_stack = NULL;
}
if (private->selection_mask)
{
g_object_unref (private->selection_mask);
private->selection_mask = NULL;
}
if (private->parasites)
{
g_object_unref (private->parasites);
private->parasites = NULL;
}
g_clear_object (&private->selection_mask);
g_clear_object (&private->parasites);
if (private->guides)
{
@ -1127,11 +1068,7 @@ gimp_image_finalize (GObject *object)
private->symmetries = NULL;
}
if (private->grid)
{
g_object_unref (private->grid);
private->grid = NULL;
}
g_clear_object (&private->grid);
if (private->sample_points)
{
@ -1140,16 +1077,8 @@ gimp_image_finalize (GObject *object)
private->sample_points = NULL;
}
if (private->undo_stack)
{
g_object_unref (private->undo_stack);
private->undo_stack = NULL;
}
if (private->redo_stack)
{
g_object_unref (private->redo_stack);
private->redo_stack = NULL;
}
g_clear_object (&private->undo_stack);
g_clear_object (&private->redo_stack);
if (image->gimp && image->gimp->image_table)
{
@ -1157,17 +1086,8 @@ gimp_image_finalize (GObject *object)
image->gimp = NULL;
}
if (private->display_name)
{
g_free (private->display_name);
private->display_name = NULL;
}
if (private->display_path)
{
g_free (private->display_path);
private->display_path = NULL;
}
g_clear_pointer (&private->display_name, g_free);
g_clear_pointer (&private->display_path, g_free);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -1182,17 +1102,8 @@ gimp_image_name_changed (GimpObject *object)
if (GIMP_OBJECT_CLASS (parent_class)->name_changed)
GIMP_OBJECT_CLASS (parent_class)->name_changed (object);
if (private->display_name)
{
g_free (private->display_name);
private->display_name = NULL;
}
if (private->display_path)
{
g_free (private->display_path);
private->display_path = NULL;
}
g_clear_pointer (&private->display_name, g_free);
g_clear_pointer (&private->display_path, g_free);
/* We never want the empty string as a name, so change empty strings
* to NULL strings (without emitting the "name-changed" signal
@ -1205,11 +1116,7 @@ gimp_image_name_changed (GimpObject *object)
name = NULL;
}
if (private->file)
{
g_object_unref (private->file);
private->file = NULL;
}
g_clear_object (&private->file);
if (name)
private->file = g_file_new_for_uri (name);

View File

@ -183,8 +183,7 @@ gimp_imagefile_dispose (GObject *object)
if (private->icon_cancellable)
{
g_cancellable_cancel (private->icon_cancellable);
g_object_unref (private->icon_cancellable);
private->icon_cancellable = NULL;
g_clear_object (&private->icon_cancellable);
}
G_OBJECT_CLASS (parent_class)->dispose (object);
@ -203,23 +202,9 @@ gimp_imagefile_finalize (GObject *object)
private->description = NULL;
}
if (private->thumbnail)
{
g_object_unref (private->thumbnail);
private->thumbnail = NULL;
}
if (private->icon)
{
g_object_unref (private->icon);
private->icon = NULL;
}
if (private->file)
{
g_object_unref (private->file);
private->file = NULL;
}
g_clear_object (&private->thumbnail);
g_clear_object (&private->icon);
g_clear_object (&private->file);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -234,11 +219,7 @@ gimp_imagefile_name_changed (GimpObject *object)
gimp_thumbnail_set_uri (private->thumbnail, gimp_object_get_name (object));
if (private->file)
{
g_object_unref (private->file);
private->file = NULL;
}
g_clear_object (&private->file);
if (gimp_object_get_name (object))
private->file = g_file_new_for_uri (gimp_object_get_name (object));
@ -680,11 +661,8 @@ gimp_imagefile_info_changed (GimpImagefile *imagefile)
private->description = NULL;
}
if (private->icon)
{
g_object_unref (GET_PRIVATE (imagefile)->icon);
private->icon = NULL;
}
g_clear_object (&private->icon);
g_signal_emit (imagefile, gimp_imagefile_signals[INFO_CHANGED], 0);
}
@ -740,11 +718,7 @@ gimp_imagefile_icon_callback (GObject *source_object,
g_object_unref (file_info);
}
if (private->icon_cancellable)
{
g_object_unref (private->icon_cancellable);
private->icon_cancellable = NULL;
}
g_clear_object (&private->icon_cancellable);
if (private->icon)
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (imagefile));

View File

@ -533,35 +533,11 @@ gimp_image_undo_free (GimpUndo *undo,
{
GimpImageUndo *image_undo = GIMP_IMAGE_UNDO (undo);
if (image_undo->grid)
{
g_object_unref (image_undo->grid);
image_undo->grid = NULL;
}
if (image_undo->colormap)
{
g_free (image_undo->colormap);
image_undo->colormap = NULL;
}
if (image_undo->metadata)
{
g_object_unref (image_undo->metadata);
image_undo->metadata = NULL;
}
if (image_undo->parasite_name)
{
g_free (image_undo->parasite_name);
image_undo->parasite_name = NULL;
}
if (image_undo->parasite)
{
gimp_parasite_free (image_undo->parasite);
image_undo->parasite = NULL;
}
g_clear_object (&image_undo->grid);
g_clear_pointer (&image_undo->colormap, g_free);
g_clear_object (&image_undo->metadata);
g_clear_pointer (&image_undo->parasite_name, g_free);
g_clear_pointer (&image_undo->parasite, gimp_parasite_free);
GIMP_UNDO_CLASS (parent_class)->free (undo, undo_mode);
}

View File

@ -362,11 +362,7 @@ gimp_item_finalize (GObject *object)
private->image = NULL;
}
if (private->parasites)
{
g_object_unref (private->parasites);
private->parasites = NULL;
}
g_clear_object (&private->parasites);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -350,23 +350,9 @@ gimp_item_prop_undo_free (GimpUndo *undo,
{
GimpItemPropUndo *item_prop_undo = GIMP_ITEM_PROP_UNDO (undo);
if (item_prop_undo->name)
{
g_free (item_prop_undo->name);
item_prop_undo->name = NULL;
}
if (item_prop_undo->parasite_name)
{
g_free (item_prop_undo->parasite_name);
item_prop_undo->parasite_name = NULL;
}
if (item_prop_undo->parasite)
{
gimp_parasite_free (item_prop_undo->parasite);
item_prop_undo->parasite = NULL;
}
g_clear_pointer (&item_prop_undo->name, g_free);
g_clear_pointer (&item_prop_undo->parasite_name, g_free);
g_clear_pointer (&item_prop_undo->parasite, gimp_parasite_free);
GIMP_UNDO_CLASS (parent_class)->free (undo, undo_mode);
}

View File

@ -168,17 +168,8 @@ gimp_item_tree_finalize (GObject *object)
GimpItemTree *tree = GIMP_ITEM_TREE (object);
GimpItemTreePrivate *private = GIMP_ITEM_TREE_GET_PRIVATE (tree);
if (private->name_hash)
{
g_hash_table_unref (private->name_hash);
private->name_hash = NULL;
}
if (tree->container)
{
g_object_unref (tree->container);
tree->container = NULL;
}
g_clear_pointer (&private->name_hash, g_hash_table_unref);
g_clear_object (&tree->container);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -133,11 +133,7 @@ gimp_item_undo_free (GimpUndo *undo,
{
GimpItemUndo *item_undo = GIMP_ITEM_UNDO (undo);
if (item_undo->item)
{
g_object_unref (item_undo->item);
item_undo->item = NULL;
}
g_clear_object (&item_undo->item);
GIMP_UNDO_CLASS (parent_class)->free (undo, undo_mode);
}

View File

@ -643,11 +643,7 @@ gimp_layer_finalize (GObject *object)
{
GimpLayer *layer = GIMP_LAYER (object);
if (layer->mask)
{
g_object_unref (layer->mask);
layer->mask = NULL;
}
g_clear_object (&layer->mask);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -189,11 +189,7 @@ gimp_layer_mask_undo_free (GimpUndo *undo,
{
GimpLayerMaskUndo *layer_mask_undo = GIMP_LAYER_MASK_UNDO (undo);
if (layer_mask_undo->layer_mask)
{
g_object_unref (layer_mask_undo->layer_mask);
layer_mask_undo->layer_mask = NULL;
}
g_clear_object (&layer_mask_undo->layer_mask);
GIMP_UNDO_CLASS (parent_class)->free (undo, undo_mode);
}

View File

@ -280,11 +280,7 @@ gimp_mask_undo_free (GimpUndo *undo,
{
GimpMaskUndo *mask_undo = GIMP_MASK_UNDO (undo);
if (mask_undo->buffer)
{
g_object_unref (mask_undo->buffer);
mask_undo->buffer = NULL;
}
g_clear_object (&mask_undo->buffer);
GIMP_UNDO_CLASS (parent_class)->free (undo, undo_mode);
}

View File

@ -68,8 +68,7 @@ gimp_paint_info_dispose (GObject *object)
if (paint_info->paint_options)
{
g_object_run_dispose (G_OBJECT (paint_info->paint_options));
g_object_unref (paint_info->paint_options);
paint_info->paint_options = NULL;
g_clear_object (&paint_info->paint_options);
}
G_OBJECT_CLASS (parent_class)->dispose (object);
@ -80,11 +79,7 @@ gimp_paint_info_finalize (GObject *object)
{
GimpPaintInfo *paint_info = GIMP_PAINT_INFO (object);
if (paint_info->blurb)
{
g_free (paint_info->blurb);
paint_info->blurb = NULL;
}
g_clear_pointer (&paint_info->blurb, g_free);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -101,11 +101,7 @@ gimp_pattern_finalize (GObject *object)
{
GimpPattern *pattern = GIMP_PATTERN (object);
if (pattern->mask)
{
gimp_temp_buf_unref (pattern->mask);
pattern->mask = NULL;
}
g_clear_pointer (&pattern->mask, gimp_temp_buf_unref);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -181,11 +181,7 @@ gimp_pattern_clipboard_changed (Gimp *gimp,
GimpObject *paste;
GeglBuffer *buffer = NULL;
if (pattern->mask)
{
gimp_temp_buf_unref (pattern->mask);
pattern->mask = NULL;
}
g_clear_pointer (&pattern->mask, gimp_temp_buf_unref);
paste = gimp_get_clipboard_object (gimp);

View File

@ -196,23 +196,9 @@ gimp_pdb_progress_finalize (GObject *object)
{
GimpPdbProgress *progress = GIMP_PDB_PROGRESS (object);
if (progress->pdb)
{
g_object_unref (progress->pdb);
progress->pdb = NULL;
}
if (progress->context)
{
g_object_unref (progress->context);
progress->context = NULL;
}
if (progress->callback_name)
{
g_free (progress->callback_name);
progress->callback_name = NULL;
}
g_clear_object (&progress->pdb);
g_clear_object (&progress->context);
g_clear_pointer (&progress->callback_name, g_free);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -564,8 +564,7 @@ gimp_projection_stop_rendering (GimpProjection *proj)
cairo_region_copy (chunk_render->update_region);
}
cairo_region_destroy (chunk_render->update_region);
chunk_render->update_region = NULL;
g_clear_pointer (&chunk_render->update_region, cairo_region_destroy);
}
rect.x = chunk_render->x;
@ -622,17 +621,8 @@ gimp_projection_free_buffer (GimpProjection *proj)
if (proj->priv->chunk_render.idle_id)
gimp_projection_chunk_render_stop (proj);
if (proj->priv->update_region)
{
cairo_region_destroy (proj->priv->update_region);
proj->priv->update_region = NULL;
}
if (proj->priv->chunk_render.update_region)
{
cairo_region_destroy (proj->priv->chunk_render.update_region);
proj->priv->chunk_render.update_region = NULL;
}
g_clear_pointer (&proj->priv->update_region, cairo_region_destroy);
g_clear_pointer (&proj->priv->chunk_render.update_region, cairo_region_destroy);
if (proj->priv->buffer)
{
@ -640,15 +630,10 @@ gimp_projection_free_buffer (GimpProjection *proj)
gegl_buffer_remove_handler (proj->priv->buffer,
proj->priv->validate_handler);
g_object_unref (proj->priv->buffer);
proj->priv->buffer = NULL;
g_clear_object (&proj->priv->buffer);
}
if (proj->priv->validate_handler)
{
g_object_unref (proj->priv->validate_handler);
proj->priv->validate_handler = NULL;
}
g_clear_object (&proj->priv->validate_handler);
}
static void
@ -715,8 +700,7 @@ gimp_projection_flush_whenever (GimpProjection *proj,
}
/* Free the update region */
cairo_region_destroy (proj->priv->update_region);
proj->priv->update_region = NULL;
g_clear_pointer (&proj->priv->update_region, cairo_region_destroy);
}
else if (! now && proj->priv->invalidate_preview)
{
@ -906,8 +890,7 @@ gimp_projection_chunk_render_next_area (GimpProjection *proj)
if (cairo_region_is_empty (chunk_render->update_region))
{
cairo_region_destroy (chunk_render->update_region);
chunk_render->update_region = NULL;
g_clear_pointer (&chunk_render->update_region, cairo_region_destroy);
return FALSE;
}
@ -926,8 +909,7 @@ gimp_projection_chunk_render_next_area (GimpProjection *proj)
if (cairo_region_is_empty (chunk_render->update_region))
{
cairo_region_destroy (chunk_render->update_region);
chunk_render->update_region = NULL;
g_clear_pointer (&chunk_render->update_region, cairo_region_destroy);
}
chunk_render->x = rect.x;

View File

@ -181,11 +181,7 @@ gimp_sample_point_undo_free (GimpUndo *undo,
{
GimpSamplePointUndo *sample_point_undo = GIMP_SAMPLE_POINT_UNDO (undo);
if (sample_point_undo->sample_point)
{
gimp_sample_point_unref (sample_point_undo->sample_point);
sample_point_undo->sample_point = NULL;
}
g_clear_pointer (&sample_point_undo->sample_point, gimp_sample_point_unref);
GIMP_UNDO_CLASS (parent_class)->free (undo, undo_mode);
}

View File

@ -259,11 +259,7 @@ gimp_stroke_options_finalize (GObject *object)
private->dash_info = NULL;
}
if (private->paint_options)
{
g_object_unref (private->paint_options);
private->paint_options = NULL;
}
g_clear_object (&private->paint_options);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -76,11 +76,7 @@ gimp_sub_progress_finalize (GObject *object)
{
GimpSubProgress *sub = GIMP_SUB_PROGRESS (object);
if (sub->progress)
{
g_object_unref (sub->progress);
sub->progress = NULL;
}
g_clear_object (&sub->progress);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -176,13 +176,8 @@ gimp_mandala_finalize (GObject *object)
{
GimpMandala *mandala = GIMP_MANDALA (object);
if (mandala->horizontal_guide)
g_object_unref (mandala->horizontal_guide);
mandala->horizontal_guide = NULL;
if (mandala->vertical_guide)
g_object_unref (mandala->vertical_guide);
mandala->vertical_guide = NULL;
g_clear_object (&mandala->horizontal_guide);
g_clear_object (&mandala->vertical_guide);
if (mandala->ops)
{
@ -523,6 +518,7 @@ gimp_mandala_get_operation (GimpSymmetry *sym,
if (iter->data)
g_object_unref (G_OBJECT (iter->data));
}
g_list_free (mandala->ops);
mandala->ops = NULL;
}

View File

@ -202,25 +202,12 @@ gimp_mirror_finalize (GObject *object)
{
GimpMirror *mirror = GIMP_MIRROR (object);
if (mirror->horizontal_guide)
g_object_unref (mirror->horizontal_guide);
mirror->horizontal_guide = NULL;
g_clear_object (&mirror->horizontal_guide);
g_clear_object (&mirror->vertical_guide);
if (mirror->vertical_guide)
g_object_unref (mirror->vertical_guide);
mirror->vertical_guide = NULL;
if (mirror->horizontal_op)
g_object_unref (mirror->horizontal_op);
mirror->horizontal_op = NULL;
if (mirror->vertical_op)
g_object_unref (mirror->vertical_op);
mirror->vertical_op = NULL;
if (mirror->central_op)
g_object_unref (mirror->central_op);
mirror->central_op = NULL;
g_clear_object (&mirror->horizontal_op);
g_clear_object (&mirror->vertical_op);
g_clear_object (&mirror->central_op);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -158,11 +158,9 @@ gimp_symmetry_finalize (GObject *object)
{
GimpSymmetry *sym = GIMP_SYMMETRY (object);
if (sym->drawable)
g_object_unref (sym->drawable);
g_clear_object (&sym->drawable);
g_free (sym->origin);
sym->origin = NULL;
g_clear_pointer (&sym->origin, g_free);
g_list_free_full (sym->strokes, g_free);
sym->strokes = NULL;

View File

@ -130,11 +130,7 @@ gimp_tagged_container_dispose (GObject *object)
tagged_container->filter = NULL;
}
if (tagged_container->tag_ref_counts)
{
g_hash_table_unref (tagged_container->tag_ref_counts);
tagged_container->tag_ref_counts = NULL;
}
g_clear_pointer (&tagged_container->tag_ref_counts, g_hash_table_unref);
G_OBJECT_CLASS (parent_class)->dispose (object);
}

View File

@ -259,23 +259,9 @@ gimp_template_finalize (GObject *object)
{
GimpTemplatePrivate *private = GET_PRIVATE (object);
if (private->color_profile)
{
g_object_unref (private->color_profile);
private->color_profile = NULL;
}
if (private->comment)
{
g_free (private->comment);
private->comment = NULL;
}
if (private->filename)
{
g_free (private->filename);
private->filename = NULL;
}
g_clear_object (&private->color_profile);
g_clear_pointer (&private->comment, g_free);
g_clear_pointer (&private->filename, g_free);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -98,15 +98,10 @@ gimp_tool_info_dispose (GObject *object)
if (tool_info->tool_options)
{
g_object_run_dispose (G_OBJECT (tool_info->tool_options));
g_object_unref (tool_info->tool_options);
tool_info->tool_options = NULL;
g_clear_object (&tool_info->tool_options);
}
if (tool_info->presets)
{
g_object_unref (tool_info->presets);
tool_info->presets = NULL;
}
g_clear_object (&tool_info->presets);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@ -116,38 +111,12 @@ gimp_tool_info_finalize (GObject *object)
{
GimpToolInfo *tool_info = GIMP_TOOL_INFO (object);
if (tool_info->label)
{
g_free (tool_info->label);
tool_info->label = NULL;
}
if (tool_info->tooltip)
{
g_free (tool_info->tooltip);
tool_info->tooltip = NULL;
}
if (tool_info->menu_label)
{
g_free (tool_info->menu_label);
tool_info->menu_label = NULL;
}
if (tool_info->menu_accel)
{
g_free (tool_info->menu_accel);
tool_info->menu_accel = NULL;
}
if (tool_info->help_domain)
{
g_free (tool_info->help_domain);
tool_info->help_domain = NULL;
}
if (tool_info->help_id)
{
g_free (tool_info->help_id);
tool_info->help_id = NULL;
}
g_clear_pointer (&tool_info->label, g_free);
g_clear_pointer (&tool_info->tooltip, g_free);
g_clear_pointer (&tool_info->menu_label, g_free);
g_clear_pointer (&tool_info->menu_accel, g_free);
g_clear_pointer (&tool_info->help_domain, g_free);
g_clear_pointer (&tool_info->help_id, g_free);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -106,11 +106,7 @@ gimp_tool_options_dispose (GObject *object)
{
GimpToolOptions *options = GIMP_TOOL_OPTIONS (object);
if (options->tool_info)
{
g_object_unref (options->tool_info);
options->tool_info = NULL;
}
g_clear_object (&options->tool_info);
G_OBJECT_CLASS (parent_class)->dispose (object);
}

View File

@ -495,12 +495,11 @@ gimp_tool_preset_set_options (GimpToolPreset *preset,
gimp_tool_preset_options_notify,
preset);
g_signal_handlers_disconnect_by_func (preset->tool_options,
gimp_tool_preset_options_prop_name_changed,
preset);
g_signal_handlers_disconnect_by_func (preset->tool_options,
gimp_tool_preset_options_prop_name_changed,
preset);
g_object_unref (preset->tool_options);
preset->tool_options = NULL;
g_clear_object (&preset->tool_options);
}
if (options)

View File

@ -89,11 +89,8 @@ gimp_tree_handler_dispose (GObject *object)
if (! gimp_container_frozen (handler->container))
gimp_tree_handler_remove_container (handler, handler->container);
g_object_unref (handler->container);
handler->container = NULL;
g_free (handler->signal_name);
handler->signal_name = NULL;
g_clear_object (&handler->container);
g_clear_pointer (&handler->signal_name, g_free);
}
G_OBJECT_CLASS (parent_class)->dispose (object);

View File

@ -198,11 +198,7 @@ gimp_undo_finalize (GObject *object)
undo->preview_idle_id = 0;
}
if (undo->preview)
{
gimp_temp_buf_unref (undo->preview);
undo->preview = NULL;
}
g_clear_pointer (&undo->preview, gimp_temp_buf_unref);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -513,8 +509,7 @@ gimp_undo_refresh_preview (GimpUndo *undo,
if (undo->preview)
{
gimp_temp_buf_unref (undo->preview);
undo->preview = NULL;
g_clear_pointer (&undo->preview, gimp_temp_buf_unref);
gimp_undo_create_preview (undo, context, FALSE);
}
}

View File

@ -71,11 +71,7 @@ gimp_undo_stack_finalize (GObject *object)
{
GimpUndoStack *stack = GIMP_UNDO_STACK (object);
if (stack->undos)
{
g_object_unref (stack->undos);
stack->undos = NULL;
}
g_clear_object (&stack->undos);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -230,29 +230,10 @@ gimp_viewable_finalize (GObject *object)
{
GimpViewablePrivate *private = GET_PRIVATE (object);
if (private->icon_name)
{
g_free (private->icon_name);
private->icon_name = NULL;
}
if (private->icon_pixbuf)
{
g_object_unref (private->icon_pixbuf);
private->icon_pixbuf = NULL;
}
if (private->preview_temp_buf)
{
gimp_temp_buf_unref (private->preview_temp_buf);
private->preview_temp_buf = NULL;
}
if (private->preview_pixbuf)
{
g_object_unref (private->preview_pixbuf);
private->preview_pixbuf = NULL;
}
g_clear_pointer (&private->icon_name, g_free);
g_clear_object (&private->icon_pixbuf);
g_clear_pointer (&private->preview_temp_buf, gimp_temp_buf_unref);
g_clear_object (&private->preview_pixbuf);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -341,17 +322,8 @@ gimp_viewable_real_invalidate_preview (GimpViewable *viewable)
{
GimpViewablePrivate *private = GET_PRIVATE (viewable);
if (private->preview_temp_buf)
{
gimp_temp_buf_unref (private->preview_temp_buf);
private->preview_temp_buf = NULL;
}
if (private->preview_pixbuf)
{
g_object_unref (private->preview_pixbuf);
private->preview_pixbuf = NULL;
}
g_clear_pointer (&private->preview_temp_buf, gimp_temp_buf_unref);
g_clear_object (&private->preview_pixbuf);
}
static void
@ -848,8 +820,7 @@ gimp_viewable_get_preview (GimpViewable *viewable,
return private->preview_temp_buf;
}
gimp_temp_buf_unref (private->preview_temp_buf);
private->preview_temp_buf = NULL;
g_clear_pointer (&private->preview_temp_buf, gimp_temp_buf_unref);
}
if (viewable_class->get_new_preview)
@ -1006,8 +977,7 @@ gimp_viewable_get_pixbuf (GimpViewable *viewable,
return private->preview_pixbuf;
}
g_object_unref (private->preview_pixbuf);
private->preview_pixbuf = NULL;
g_clear_object (&private->preview_pixbuf);
}
if (viewable_class->get_new_pixbuf)

View File

@ -562,11 +562,7 @@ dialogs_exit (Gimp *gimp)
gimp_dialog_factory_set_singleton (NULL);
}
if (global_recent_docks)
{
g_object_unref (global_recent_docks);
global_recent_docks = NULL;
}
g_clear_object (&global_recent_docks);
}
static void

View File

@ -148,11 +148,7 @@ gimp_canvas_unrealize (GtkWidget *widget)
{
GimpCanvas *canvas = GIMP_CANVAS (widget);
if (canvas->layout)
{
g_object_unref (canvas->layout);
canvas->layout = NULL;
}
g_clear_object (&canvas->layout);
GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
}
@ -165,11 +161,7 @@ gimp_canvas_style_set (GtkWidget *widget,
GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
if (canvas->layout)
{
g_object_unref (canvas->layout);
canvas->layout = NULL;
}
g_clear_object (&canvas->layout);
}
static gboolean

View File

@ -123,11 +123,7 @@ gimp_canvas_grid_finalize (GObject *object)
{
GimpCanvasGridPrivate *private = GET_PRIVATE (object);
if (private->grid)
{
g_object_unref (private->grid);
private->grid = NULL;
}
g_clear_object (&private->grid);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -517,10 +517,9 @@ gimp_canvas_item_end_change (GimpCanvasItem *item)
cairo_region_destroy (region);
}
}
else if (private->change_region)
else
{
cairo_region_destroy (private->change_region);
private->change_region = NULL;
g_clear_pointer (&private->change_region, cairo_region_destroy);
}
}
}

View File

@ -96,11 +96,7 @@ gimp_canvas_proxy_group_finalize (GObject *object)
{
GimpCanvasProxyGroupPrivate *private = GET_PRIVATE (object);
if (private->proxy_hash)
{
g_hash_table_unref (private->proxy_hash);
private->proxy_hash = NULL;
}
g_clear_pointer (&private->proxy_hash, g_hash_table_unref);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -650,11 +650,7 @@ gimp_display_set_image (GimpDisplay *display,
gimp_display_disconnect (display);
if (private->update_region)
{
cairo_region_destroy (private->update_region);
private->update_region = NULL;
}
g_clear_pointer (&private->update_region, cairo_region_destroy);
gimp_image_dec_display_count (private->image);
@ -851,8 +847,7 @@ gimp_display_flush_whenever (GimpDisplay *display,
rect.height);
}
cairo_region_destroy (private->update_region);
private->update_region = NULL;
g_clear_pointer (&private->update_region, cairo_region_destroy);
}
if (now)

View File

@ -976,11 +976,7 @@ gimp_display_shell_check_notify_handler (GObject *config,
GimpCanvasPaddingMode padding_mode;
GimpRGB padding_color;
if (shell->checkerboard)
{
cairo_pattern_destroy (shell->checkerboard);
shell->checkerboard = NULL;
}
g_clear_pointer (&shell->checkerboard, cairo_pattern_destroy);
gimp_display_shell_get_padding (shell, &padding_mode, &padding_color);
@ -1011,11 +1007,7 @@ gimp_display_shell_nav_size_notify_handler (GObject *config,
GParamSpec *param_spec,
GimpDisplayShell *shell)
{
if (shell->nav_popup)
{
gtk_widget_destroy (shell->nav_popup);
shell->nav_popup = NULL;
}
g_clear_pointer (&shell->nav_popup, gtk_widget_destroy);
}
static void

View File

@ -120,8 +120,7 @@ gimp_display_shell_items_free (GimpDisplayShell *shell)
gimp_display_shell_item_update,
shell);
g_object_unref (shell->canvas_item);
shell->canvas_item = NULL;
g_clear_object (&shell->canvas_item);
shell->passe_partout = NULL;
shell->preview_items = NULL;
@ -139,8 +138,7 @@ gimp_display_shell_items_free (GimpDisplayShell *shell)
gimp_display_shell_unrotated_item_update,
shell);
g_object_unref (shell->unrotated_item);
shell->unrotated_item = NULL;
g_clear_object (&shell->unrotated_item);
shell->cursor = NULL;
}

View File

@ -76,11 +76,7 @@ gimp_display_shell_profile_init (GimpDisplayShell *shell)
void
gimp_display_shell_profile_finalize (GimpDisplayShell *shell)
{
if (shell->color_config)
{
g_object_unref (shell->color_config);
shell->color_config = NULL;
}
g_clear_object (&shell->color_config);
gimp_display_shell_profile_free (shell);
}
@ -187,19 +183,10 @@ gimp_display_shell_profile_can_convert_to_u8 (GimpDisplayShell *shell)
static void
gimp_display_shell_profile_free (GimpDisplayShell *shell)
{
if (shell->profile_transform)
{
g_object_unref (shell->profile_transform);
shell->profile_transform = NULL;
}
if (shell->profile_buffer)
{
g_object_unref (shell->profile_buffer);
shell->profile_buffer = NULL;
shell->profile_data = NULL;
shell->profile_stride = 0;
}
g_clear_object (&shell->profile_transform);
g_clear_object (&shell->profile_buffer);
shell->profile_data = NULL;
shell->profile_stride = 0;
}
static void

View File

@ -401,25 +401,13 @@ selection_generate_segs (Selection *selection)
static void
selection_free_segs (Selection *selection)
{
if (selection->segs_in)
{
g_free (selection->segs_in);
selection->segs_in = NULL;
selection->n_segs_in = 0;
}
g_clear_pointer (&selection->segs_in, g_free);
selection->n_segs_in = 0;
if (selection->segs_out)
{
g_free (selection->segs_out);
selection->segs_out = NULL;
selection->n_segs_out = 0;
}
g_clear_pointer (&selection->segs_out, g_free);
selection->segs_out = NULL;
if (selection->segs_in_mask)
{
cairo_pattern_destroy (selection->segs_in_mask);
selection->segs_in_mask = NULL;
}
g_clear_pointer (&selection->segs_in_mask, cairo_pattern_destroy);
}
static gboolean

View File

@ -819,47 +819,22 @@ gimp_display_shell_dispose (GObject *object)
shell->filter_idle_id = 0;
}
if (shell->mask_surface)
{
cairo_surface_destroy (shell->mask_surface);
shell->mask_surface = NULL;
}
if (shell->checkerboard)
{
cairo_pattern_destroy (shell->checkerboard);
shell->checkerboard = NULL;
}
g_clear_pointer (&shell->mask_surface, cairo_surface_destroy);
g_clear_pointer (&shell->checkerboard, cairo_pattern_destroy);
gimp_display_shell_profile_finalize (shell);
if (shell->filter_buffer)
{
g_object_unref (shell->filter_buffer);
shell->filter_buffer = NULL;
shell->filter_data = NULL;
shell->filter_stride = 0;
}
g_clear_object (&shell->filter_buffer);
shell->filter_data = NULL;
shell->filter_stride = 0;
if (shell->mask)
{
g_object_unref (shell->mask);
shell->mask = NULL;
}
g_clear_object (&shell->mask);
gimp_display_shell_items_free (shell);
if (shell->motion_buffer)
{
g_object_unref (shell->motion_buffer);
shell->motion_buffer = NULL;
}
g_clear_object (&shell->motion_buffer);
if (shell->zoom_focus_pointer_queue)
{
g_queue_free (shell->zoom_focus_pointer_queue);
shell->zoom_focus_pointer_queue = NULL;
}
g_clear_pointer (&shell->zoom_focus_pointer_queue, g_queue_free);
if (shell->title_idle_id)
{
@ -873,11 +848,7 @@ gimp_display_shell_dispose (GObject *object)
shell->fill_idle_id = 0;
}
if (shell->nav_popup)
{
gtk_widget_destroy (shell->nav_popup);
shell->nav_popup = NULL;
}
g_clear_pointer (&shell->nav_popup, gtk_widget_destroy);
if (shell->blink_timeout_id)
{
@ -895,31 +866,15 @@ gimp_display_shell_finalize (GObject *object)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (object);
g_object_unref (shell->zoom);
if (shell->rotate_transform)
g_free (shell->rotate_transform);
if (shell->rotate_untransform)
g_free (shell->rotate_untransform);
if (shell->options)
g_object_unref (shell->options);
if (shell->fullscreen_options)
g_object_unref (shell->fullscreen_options);
if (shell->no_image_options)
g_object_unref (shell->no_image_options);
if (shell->title)
g_free (shell->title);
if (shell->status)
g_free (shell->status);
if (shell->icon)
g_object_unref (shell->icon);
g_clear_object (&shell->zoom);
g_clear_pointer (&shell->rotate_transform, g_free);
g_clear_pointer (&shell->rotate_untransform, g_free);
g_clear_object (&shell->options);
g_clear_object (&shell->fullscreen_options);
g_clear_object (&shell->no_image_options);
g_clear_pointer (&shell->title, g_free);
g_clear_pointer (&shell->status, g_free);
g_clear_object (&shell->icon);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -528,11 +528,7 @@ gimp_image_window_dispose (GObject *object)
private->dialog_factory = NULL;
}
if (private->menubar_manager)
{
g_object_unref (private->menubar_manager);
private->menubar_manager = NULL;
}
g_clear_object (&private->menubar_manager);
if (private->update_ui_manager_idle_id)
{

View File

@ -309,27 +309,14 @@ gimp_statusbar_finalize (GObject *object)
{
GimpStatusbar *statusbar = GIMP_STATUSBAR (object);
if (statusbar->icon)
{
g_object_unref (statusbar->icon);
statusbar->icon = NULL;
}
if (statusbar->icon_hash)
{
g_hash_table_unref (statusbar->icon_hash);
statusbar->icon_hash = NULL;
}
g_clear_object (&statusbar->icon);
g_clear_pointer (&statusbar->icon_hash, g_hash_table_unref);
g_slist_free_full (statusbar->messages,
(GDestroyNotify) gimp_statusbar_msg_free);
statusbar->messages = NULL;
if (statusbar->context_ids)
{
g_hash_table_destroy (statusbar->context_ids);
statusbar->context_ids = NULL;
}
g_clear_pointer (&statusbar->context_ids, g_hash_table_destroy);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -343,11 +330,7 @@ gimp_statusbar_screen_changed (GtkWidget *widget,
if (GTK_WIDGET_CLASS (parent_class)->screen_changed)
GTK_WIDGET_CLASS (parent_class)->screen_changed (widget, previous);
if (statusbar->icon_hash)
{
g_hash_table_unref (statusbar->icon_hash);
statusbar->icon_hash = NULL;
}
g_clear_pointer (&statusbar->icon_hash, g_hash_table_unref);
}
static void
@ -358,11 +341,7 @@ gimp_statusbar_style_set (GtkWidget *widget,
GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
if (statusbar->icon_hash)
{
g_hash_table_unref (statusbar->icon_hash);
statusbar->icon_hash = NULL;
}
g_clear_pointer (&statusbar->icon_hash, g_hash_table_unref);
}
static void
@ -656,11 +635,7 @@ gimp_statusbar_set_text (GimpStatusbar *statusbar,
}
else
{
if (statusbar->icon)
{
g_object_unref (statusbar->icon);
statusbar->icon = NULL;
}
g_clear_object (&statusbar->icon);
if (icon_name)
statusbar->icon = gimp_statusbar_load_icon (statusbar, icon_name);

View File

@ -155,20 +155,12 @@ gimp_tool_gui_dispose (GObject *object)
{
GimpToolGuiPrivate *private = GET_PRIVATE (object);
if (private->tool_info)
{
g_object_unref (private->tool_info);
private->tool_info = NULL;
}
g_clear_object (&private->tool_info);
if (private->shell)
gimp_tool_gui_set_shell (GIMP_TOOL_GUI (object), NULL);
if (private->vbox)
{
g_object_unref (private->vbox);
private->vbox = NULL;
}
g_clear_object (&private->vbox);
if (private->dialog)
{
@ -191,29 +183,10 @@ gimp_tool_gui_finalize (GObject *object)
{
GimpToolGuiPrivate *private = GET_PRIVATE (object);
if (private->title)
{
g_free (private->title);
private->title = NULL;
}
if (private->description)
{
g_free (private->description);
private->description = NULL;
}
if (private->icon_name)
{
g_free (private->icon_name);
private->icon_name = NULL;
}
if (private->help_id)
{
g_free (private->help_id);
private->help_id = NULL;
}
g_clear_pointer (&private->title, g_free);
g_clear_pointer (&private->description, g_free);
g_clear_pointer (&private->icon_name, g_free);
g_clear_pointer (&private->help_id, g_free);
if (private->response_entries)
{

View File

@ -226,7 +226,7 @@ static void
gimp_tool_line_init (GimpToolLine *line)
{
GimpToolLinePrivate *private;
private = line->private = G_TYPE_INSTANCE_GET_PRIVATE (line,
GIMP_TYPE_TOOL_LINE,
GimpToolLinePrivate);
@ -301,29 +301,10 @@ gimp_tool_line_finalize (GObject *object)
GimpToolLine *line = GIMP_TOOL_LINE (object);
GimpToolLinePrivate *private = line->private;
if (private->sliders)
{
g_array_unref (private->sliders);
private->sliders = NULL;
}
if (private->status_title)
{
g_free (private->status_title);
private->status_title = NULL;
}
if (private->slider_handle_circles)
{
g_array_unref (private->slider_handle_circles);
private->slider_handle_circles = NULL;
}
if (private->slider_handle_grips)
{
g_array_unref (private->slider_handle_grips);
private->slider_handle_grips = NULL;
}
g_clear_pointer (&private->sliders, g_array_unref);
g_clear_pointer (&private->status_title, g_free);
g_clear_pointer (&private->slider_handle_circles, g_array_unref);
g_clear_pointer (&private->slider_handle_grips, g_array_unref);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -262,11 +262,7 @@ gimp_tool_polygon_finalize (GObject *object)
g_free (private->saved_points_lower_segment);
g_free (private->saved_points_higher_segment);
if (private->handles)
{
g_ptr_array_unref (private->handles);
private->handles = NULL;
}
g_clear_pointer (&private->handles, g_ptr_array_unref);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -114,14 +114,8 @@ gimp_tile_handler_validate_finalize (GObject *object)
{
GimpTileHandlerValidate *validate = GIMP_TILE_HANDLER_VALIDATE (object);
if (validate->graph)
{
g_object_unref (validate->graph);
validate->graph = NULL;
}
cairo_region_destroy (validate->dirty_region);
validate->dirty_region = NULL;
g_clear_object (&validate->graph);
g_clear_pointer (&validate->dirty_region, cairo_region_destroy);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -100,11 +100,7 @@ gimp_operation_cage_coef_calc_finalize (GObject *object)
{
GimpOperationCageCoefCalc *self = GIMP_OPERATION_CAGE_COEF_CALC (object);
if (self->config)
{
g_object_unref (self->config);
self->config = NULL;
}
g_clear_object (&self->config);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -141,11 +141,7 @@ gimp_operation_cage_transform_finalize (GObject *object)
{
GimpOperationCageTransform *self = GIMP_OPERATION_CAGE_TRANSFORM (object);
if (self->config)
{
g_object_unref (self->config);
self->config = NULL;
}
g_clear_object (&self->config);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -105,17 +105,10 @@ gimp_operation_equalize_finalize (GObject *object)
{
GimpOperationEqualize *self = GIMP_OPERATION_EQUALIZE (object);
if (self->values)
{
g_free (self->values);
self->values = NULL;
}
g_clear_pointer (&self->values, g_free);
g_clear_object (&self->histogram);
if (self->histogram)
{
g_object_unref (self->histogram);
self->histogram = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void

View File

@ -113,11 +113,7 @@ gimp_operation_histogram_sink_finalize (GObject *object)
{
GimpOperationHistogramSink *sink = GIMP_OPERATION_HISTOGRAM_SINK (object);
if (sink->histogram)
{
g_object_unref (sink->histogram);
sink->histogram = NULL;
}
g_clear_object (&sink->histogram);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -58,11 +58,7 @@ gimp_operation_point_filter_finalize (GObject *object)
{
GimpOperationPointFilter *self = GIMP_OPERATION_POINT_FILTER (object);
if (self->config)
{
g_object_unref (self->config);
self->config = NULL;
}
g_clear_object (&self->config);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -150,23 +150,9 @@ gimp_operation_profile_transform_finalize (GObject *object)
{
GimpOperationProfileTransform *self = GIMP_OPERATION_PROFILE_TRANSFORM (object);
if (self->src_profile)
{
g_object_unref (self->src_profile);
self->src_profile = NULL;
}
if (self->dest_profile)
{
g_object_unref (self->dest_profile);
self->dest_profile = NULL;
}
if (self->transform)
{
g_object_unref (self->transform);
self->transform = NULL;
}
g_clear_object (&self->src_profile);
g_clear_object (&self->dest_profile);
g_clear_object (&self->transform);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -260,11 +246,7 @@ gimp_operation_profile_transform_prepare (GeglOperation *operation)
{
GimpOperationProfileTransform *self = GIMP_OPERATION_PROFILE_TRANSFORM (operation);
if (self->transform)
{
g_object_unref (self->transform);
self->transform = NULL;
}
g_clear_object (&self->transform);
if (! self->src_format)
self->src_format = babl_format ("RGBA float");

View File

@ -102,8 +102,7 @@ gimp_paint_exit (Gimp *gimp)
{
gimp_container_foreach (gimp->paint_info_list,
(GFunc) g_object_run_dispose, NULL);
g_object_unref (gimp->paint_info_list);
gimp->paint_info_list = NULL;
g_clear_object (&gimp->paint_info_list);
}
}

View File

@ -96,11 +96,7 @@ gimp_airbrush_finalize (GObject *object)
airbrush->timeout_id = 0;
}
if (airbrush->sym)
{
g_object_unref (airbrush->sym);
airbrush->sym = NULL;
}
g_clear_object (&airbrush->sym);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -171,16 +167,12 @@ gimp_airbrush_paint (GimpPaintCore *paint_core,
break;
case GIMP_PAINT_STATE_FINISH:
if (airbrush->sym)
{
g_object_unref (airbrush->sym);
airbrush->sym = NULL;
}
GIMP_PAINT_CORE_CLASS (parent_class)->paint (paint_core, drawable,
paint_options,
sym,
paint_state, time);
g_clear_object (&airbrush->sym);
break;
}
}

View File

@ -245,33 +245,17 @@ gimp_brush_core_finalize (GObject *object)
GimpBrushCore *core = GIMP_BRUSH_CORE (object);
gint i, j;
if (core->pressure_brush)
{
gimp_temp_buf_unref (core->pressure_brush);
core->pressure_brush = NULL;
}
g_clear_pointer (&core->pressure_brush, gimp_temp_buf_unref);
for (i = 0; i < BRUSH_CORE_SOLID_SUBSAMPLE; i++)
for (j = 0; j < BRUSH_CORE_SOLID_SUBSAMPLE; j++)
if (core->solid_brushes[i][j])
{
gimp_temp_buf_unref (core->solid_brushes[i][j]);
core->solid_brushes[i][j] = NULL;
}
g_clear_pointer (&core->solid_brushes[i][j], gimp_temp_buf_unref);
if (core->rand)
{
g_rand_free (core->rand);
core->rand = NULL;
}
g_clear_pointer (&core->rand, g_rand_free);
for (i = 0; i < KERNEL_SUBSAMPLE + 1; i++)
for (j = 0; j < KERNEL_SUBSAMPLE + 1; j++)
if (core->subsample_brushes[i][j])
{
gimp_temp_buf_unref (core->subsample_brushes[i][j]);
core->subsample_brushes[i][j] = NULL;
}
g_clear_pointer (&core->subsample_brushes[i][j], gimp_temp_buf_unref);
if (core->main_brush)
{
@ -279,15 +263,10 @@ gimp_brush_core_finalize (GObject *object)
gimp_brush_core_invalidate_cache,
core);
gimp_brush_end_use (core->main_brush);
g_object_unref (core->main_brush);
core->main_brush = NULL;
g_clear_object (&core->main_brush);
}
if (core->dynamics)
{
g_object_unref (core->dynamics);
core->dynamics = NULL;
}
g_clear_object (&core->dynamics);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -884,8 +863,7 @@ gimp_brush_core_get_paint_buffer (GimpPaintCore *paint_core,
*paint_buffer_x = x1;
*paint_buffer_y = y1;
if (paint_core->paint_buffer)
g_object_unref (paint_core->paint_buffer);
g_clear_object (&paint_core->paint_buffer);
paint_core->paint_buffer = gimp_temp_buf_create_buffer (temp_buf);
@ -910,8 +888,7 @@ gimp_brush_core_real_set_brush (GimpBrushCore *core,
gimp_brush_core_invalidate_cache,
core);
gimp_brush_end_use (core->main_brush);
g_object_unref (core->main_brush);
core->main_brush = NULL;
g_clear_object (&core->main_brush);
}
core->main_brush = brush;
@ -933,13 +910,10 @@ gimp_brush_core_real_set_dynamics (GimpBrushCore *core,
if (dynamics == core->dynamics)
return;
if (core->dynamics)
g_object_unref (core->dynamics);
g_clear_object (&core->dynamics);
core->dynamics = dynamics;
if (core->dynamics)
g_object_ref (core->dynamics);
if (dynamics)
core->dynamics = g_object_ref (dynamics);
}
void
@ -1158,11 +1132,7 @@ gimp_brush_core_subsample_mask (GimpBrushCore *core,
{
for (i = 0; i < KERNEL_SUBSAMPLE + 1; i++)
for (j = 0; j < KERNEL_SUBSAMPLE + 1; j++)
if (core->subsample_brushes[i][j])
{
gimp_temp_buf_unref (core->subsample_brushes[i][j]);
core->subsample_brushes[i][j] = NULL;
}
g_clear_pointer (&core->subsample_brushes[i][j], gimp_temp_buf_unref);
core->last_subsample_brush_mask = mask;
core->subsample_cache_invalid = FALSE;
@ -1249,8 +1219,7 @@ gimp_brush_core_pressurize_mask (GimpBrushCore *core,
if ((gint) (pressure * 100 + 0.5) == 50)
return subsample_mask;
if (core->pressure_brush)
gimp_temp_buf_unref (core->pressure_brush);
g_clear_pointer (&core->pressure_brush, gimp_temp_buf_unref);
core->pressure_brush =
gimp_temp_buf_new (gimp_temp_buf_get_width (brush_mask) + 2,
@ -1388,11 +1357,7 @@ gimp_brush_core_solidify_mask (GimpBrushCore *core,
{
for (i = 0; i < BRUSH_CORE_SOLID_SUBSAMPLE; i++)
for (j = 0; j < BRUSH_CORE_SOLID_SUBSAMPLE; j++)
if (core->solid_brushes[i][j])
{
gimp_temp_buf_unref (core->solid_brushes[i][j]);
core->solid_brushes[i][j] = NULL;
}
g_clear_pointer (&core->solid_brushes[i][j], gimp_temp_buf_unref);
core->last_solid_brush_mask = brush_mask;
core->solid_cache_invalid = FALSE;

View File

@ -508,10 +508,11 @@ gimp_mypaint_surface_end_atomic (MyPaintSurface *base_surface,
MyPaintRectangle *roi)
{
GimpMybrushSurface *surface = (GimpMybrushSurface *)base_surface;
roi->x = surface->dirty.x;
roi->y = surface->dirty.y;
roi->width = surface->dirty.width;
roi->height = surface->dirty.height;
roi->x = surface->dirty.x;
roi->y = surface->dirty.y;
roi->width = surface->dirty.width;
roi->height = surface->dirty.height;
surface->dirty = *GEGL_RECTANGLE (0, 0, 0, 0);
}
@ -519,11 +520,9 @@ static void
gimp_mypaint_surface_destroy (MyPaintSurface *base_surface)
{
GimpMybrushSurface *surface = (GimpMybrushSurface *)base_surface;
g_object_unref (surface->buffer);
surface->buffer = NULL;
if (surface->paint_mask)
g_object_unref (surface->paint_mask);
surface->paint_mask = NULL;
g_clear_object (&surface->buffer);
g_clear_object (&surface->paint_mask);
}
GimpMybrushSurface *
@ -534,21 +533,22 @@ gimp_mypaint_surface_new (GeglBuffer *buffer,
gint paint_mask_y)
{
GimpMybrushSurface *surface = g_malloc0 (sizeof (GimpMybrushSurface));
mypaint_surface_init ((MyPaintSurface *)surface);
surface->surface.get_color = gimp_mypaint_surface_get_color;
surface->surface.draw_dab = gimp_mypaint_surface_draw_dab;
surface->surface.get_color = gimp_mypaint_surface_get_color;
surface->surface.draw_dab = gimp_mypaint_surface_draw_dab;
surface->surface.begin_atomic = gimp_mypaint_surface_begin_atomic;
surface->surface.end_atomic = gimp_mypaint_surface_end_atomic;
surface->surface.destroy = gimp_mypaint_surface_destroy;
surface->component_mask = component_mask;
surface->buffer = g_object_ref (buffer);
surface->surface.end_atomic = gimp_mypaint_surface_end_atomic;
surface->surface.destroy = gimp_mypaint_surface_destroy;
surface->component_mask = component_mask;
surface->buffer = g_object_ref (buffer);
if (paint_mask)
surface->paint_mask = g_object_ref (paint_mask);
else
surface->paint_mask = NULL;
surface->paint_mask_x = paint_mask_x;
surface->paint_mask_y = paint_mask_y;
surface->dirty = *GEGL_RECTANGLE (0, 0, 0, 0);
surface->paint_mask = g_object_ref (paint_mask);
surface->paint_mask_x = paint_mask_x;
surface->paint_mask_y = paint_mask_y;
surface->dirty = *GEGL_RECTANGLE (0, 0, 0, 0);
return surface;
}

View File

@ -162,8 +162,7 @@ gimp_paint_core_finalize (GObject *object)
gimp_paint_core_cleanup (core);
g_free (core->undo_desc);
core->undo_desc = NULL;
g_clear_pointer (&core->undo_desc, g_free);
if (core->stroke_buffer)
{
@ -394,11 +393,7 @@ gimp_paint_core_start (GimpPaintCore *core,
core->undo_buffer = gegl_buffer_dup (gimp_drawable_get_buffer (drawable));
/* Allocate the saved proj structure */
if (core->saved_proj_buffer)
{
g_object_unref (core->saved_proj_buffer);
core->saved_proj_buffer = NULL;
}
g_clear_object (&core->saved_proj_buffer);
if (core->use_saved_proj)
{
@ -466,11 +461,7 @@ gimp_paint_core_start (GimpPaintCore *core,
}
else
{
if (core->comp_buffer)
{
g_object_unref (core->comp_buffer);
core->comp_buffer = NULL;
}
g_clear_object (&core->comp_buffer);
/* Allocate the scratch buffer if there's a component mask */
if (gimp_drawable_get_active_mask (drawable) != GIMP_COMPONENT_MASK_ALL)
@ -507,11 +498,7 @@ gimp_paint_core_finish (GimpPaintCore *core,
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
if (core->applicator)
{
g_object_unref (core->applicator);
core->applicator = NULL;
}
g_clear_object (&core->applicator);
if (core->stroke_buffer)
{
@ -519,17 +506,8 @@ gimp_paint_core_finish (GimpPaintCore *core,
core->stroke_buffer = NULL;
}
if (core->mask_buffer)
{
g_object_unref (core->mask_buffer);
core->mask_buffer = NULL;
}
if (core->comp_buffer)
{
g_object_unref (core->comp_buffer);
core->comp_buffer = NULL;
}
g_clear_object (&core->mask_buffer);
g_clear_object (&core->comp_buffer);
image = gimp_item_get_image (GIMP_ITEM (drawable));
@ -576,14 +554,8 @@ gimp_paint_core_finish (GimpPaintCore *core,
gimp_image_undo_group_end (image);
}
g_object_unref (core->undo_buffer);
core->undo_buffer = NULL;
if (core->saved_proj_buffer)
{
g_object_unref (core->saved_proj_buffer);
core->saved_proj_buffer = NULL;
}
g_clear_object (&core->undo_buffer);
g_clear_object (&core->saved_proj_buffer);
gimp_viewable_preview_thaw (GIMP_VIEWABLE (drawable));
}
@ -620,14 +592,8 @@ gimp_paint_core_cancel (GimpPaintCore *core,
GEGL_RECTANGLE (x, y, width, height));
}
g_object_unref (core->undo_buffer);
core->undo_buffer = NULL;
if (core->saved_proj_buffer)
{
g_object_unref (core->saved_proj_buffer);
core->saved_proj_buffer = NULL;
}
g_clear_object (&core->undo_buffer);
g_clear_object (&core->saved_proj_buffer);
gimp_drawable_update (drawable, x, y, width, height);
@ -639,29 +605,10 @@ gimp_paint_core_cleanup (GimpPaintCore *core)
{
g_return_if_fail (GIMP_IS_PAINT_CORE (core));
if (core->undo_buffer)
{
g_object_unref (core->undo_buffer);
core->undo_buffer = NULL;
}
if (core->saved_proj_buffer)
{
g_object_unref (core->saved_proj_buffer);
core->saved_proj_buffer = NULL;
}
if (core->canvas_buffer)
{
g_object_unref (core->canvas_buffer);
core->canvas_buffer = NULL;
}
if (core->paint_buffer)
{
g_object_unref (core->paint_buffer);
core->paint_buffer = NULL;
}
g_clear_object (&core->undo_buffer);
g_clear_object (&core->saved_proj_buffer);
g_clear_object (&core->canvas_buffer);
g_clear_object (&core->paint_buffer);
}
void

View File

@ -331,14 +331,10 @@ gimp_perspective_clone_paint (GimpPaintCore *paint_core,
break;
case GIMP_PAINT_STATE_FINISH:
if (clone->node)
{
g_object_unref (clone->node);
clone->node = NULL;
clone->crop = NULL;
clone->transform_node = NULL;
clone->dest_node = NULL;
}
g_clear_object (&clone->node);
clone->crop = NULL;
clone->transform_node = NULL;
clone->dest_node = NULL;
break;
default:

View File

@ -260,17 +260,8 @@ gimp_pdb_context_finalize (GObject *object)
{
GimpPDBContext *context = GIMP_PDB_CONTEXT (object);
if (context->paint_options_list)
{
g_object_unref (context->paint_options_list);
context->paint_options_list = NULL;
}
if (context->stroke_options)
{
g_object_unref (context->stroke_options);
context->stroke_options = NULL;
}
g_clear_object (&context->paint_options_list);
g_clear_object (&context->stroke_options);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -170,8 +170,7 @@ gimp_plug_in_progress_end (GimpPlugIn *plug_in,
if (proc_frame->progress_created)
{
gimp_free_progress (plug_in->manager->gimp, proc_frame->progress);
g_object_unref (proc_frame->progress);
proc_frame->progress = NULL;
g_clear_object (&proc_frame->progress);
}
}
}
@ -275,11 +274,7 @@ gimp_plug_in_progress_install (GimpPlugIn *plug_in,
{
gimp_plug_in_progress_end (plug_in, proc_frame);
if (proc_frame->progress)
{
g_object_unref (proc_frame->progress);
proc_frame->progress = NULL;
}
g_clear_object (&proc_frame->progress);
}
proc_frame->progress = g_object_new (GIMP_TYPE_PDB_PROGRESS,
@ -307,8 +302,8 @@ gimp_plug_in_progress_uninstall (GimpPlugIn *plug_in,
if (GIMP_IS_PDB_PROGRESS (proc_frame->progress))
{
gimp_plug_in_progress_end (plug_in, proc_frame);
g_object_unref (proc_frame->progress);
proc_frame->progress = NULL;
g_clear_object (&proc_frame->progress);
return TRUE;
}

View File

@ -168,7 +168,7 @@ gimp_plug_in_finalize (GObject *object)
{
GimpPlugIn *plug_in = GIMP_PLUG_IN (object);
g_object_unref (plug_in->file);
g_clear_object (&plug_in->file);
gimp_plug_in_proc_frame_dispose (&plug_in->main_proc_frame, plug_in);
@ -378,11 +378,8 @@ gimp_plug_in_open (GimpPlugIn *plug_in,
goto cleanup;
}
g_io_channel_unref (plug_in->his_read);
plug_in->his_read = NULL;
g_io_channel_unref (plug_in->his_write);
plug_in->his_write = NULL;
g_clear_pointer (&plug_in->his_read, g_io_channel_unref);
g_clear_pointer (&plug_in->his_write, g_io_channel_unref);
if (! synchronous)
{
@ -513,26 +510,10 @@ gimp_plug_in_close (GimpPlugIn *plug_in,
}
/* Close the pipes. */
if (plug_in->my_read != NULL)
{
g_io_channel_unref (plug_in->my_read);
plug_in->my_read = NULL;
}
if (plug_in->my_write != NULL)
{
g_io_channel_unref (plug_in->my_write);
plug_in->my_write = NULL;
}
if (plug_in->his_read != NULL)
{
g_io_channel_unref (plug_in->his_read);
plug_in->his_read = NULL;
}
if (plug_in->his_write != NULL)
{
g_io_channel_unref (plug_in->his_write);
plug_in->his_write = NULL;
}
g_clear_pointer (&plug_in->my_read, g_io_channel_unref);
g_clear_pointer (&plug_in->my_write, g_io_channel_unref);
g_clear_pointer (&plug_in->his_read, g_io_channel_unref);
g_clear_pointer (&plug_in->his_write, g_io_channel_unref);
gimp_wire_clear_error ();
@ -754,11 +735,8 @@ gimp_plug_in_prep_for_exec (gpointer data)
{
GimpPlugIn *plug_in = data;
g_io_channel_unref (plug_in->my_read);
plug_in->my_read = NULL;
g_io_channel_unref (plug_in->my_write);
plug_in->my_write = NULL;
g_clear_pointer (&plug_in->my_read, g_io_channel_unref);
g_clear_pointer (&plug_in->my_write, g_io_channel_unref);
}
#endif
@ -830,8 +808,7 @@ gimp_plug_in_main_loop (GimpPlugIn *plug_in)
g_main_loop_run (proc_frame->main_loop);
gimp_threads_enter (plug_in->manager->gimp);
g_main_loop_unref (proc_frame->main_loop);
proc_frame->main_loop = NULL;
g_clear_pointer (&proc_frame->main_loop, g_main_loop_unref);
}
void

View File

@ -263,8 +263,7 @@ gimp_plug_in_manager_call_run (GimpPlugInManager *manager,
/* main_loop is quit in gimp_plug_in_handle_extension_ack() */
g_main_loop_unref (plug_in->ext_main_loop);
plug_in->ext_main_loop = NULL;
g_clear_pointer (&plug_in->ext_main_loop, g_main_loop_unref);
}
/* If this plug-in is requested to run synchronously,
@ -282,8 +281,7 @@ gimp_plug_in_manager_call_run (GimpPlugInManager *manager,
/* main_loop is quit in gimp_plug_in_handle_proc_return() */
g_main_loop_unref (proc_frame->main_loop);
proc_frame->main_loop = NULL;
g_clear_pointer (&proc_frame->main_loop, g_main_loop_unref);
return_vals = gimp_plug_in_proc_frame_get_return_values (proc_frame);
}

View File

@ -170,17 +170,8 @@ gimp_plug_in_manager_finalize (GObject *object)
manager->plug_in_defs = NULL;
}
if (manager->environ_table)
{
g_object_unref (manager->environ_table);
manager->environ_table = NULL;
}
if (manager->interpreter_db)
{
g_object_unref (manager->interpreter_db);
manager->interpreter_db = NULL;
}
g_clear_object (&manager->environ_table);
g_clear_object (&manager->interpreter_db);
if (manager->debug)
{

View File

@ -100,11 +100,7 @@ gimp_plug_in_proc_frame_dispose (GimpPlugInProcFrame *proc_frame,
{
gimp_plug_in_progress_end (plug_in, proc_frame);
if (proc_frame->progress)
{
g_object_unref (proc_frame->progress);
proc_frame->progress = NULL;
}
g_clear_object (&proc_frame->progress);
}
if (proc_frame->context_stack)
@ -114,32 +110,14 @@ gimp_plug_in_proc_frame_dispose (GimpPlugInProcFrame *proc_frame,
proc_frame->context_stack = NULL;
}
if (proc_frame->main_context)
{
g_object_unref (proc_frame->main_context);
proc_frame->main_context = NULL;
}
if (proc_frame->return_vals)
{
gimp_value_array_unref (proc_frame->return_vals);
proc_frame->return_vals = NULL;
}
if (proc_frame->main_loop)
{
g_main_loop_unref (proc_frame->main_loop);
proc_frame->main_loop = NULL;
}
g_clear_object (&proc_frame->main_context);
g_clear_pointer (&proc_frame->return_vals, gimp_value_array_unref);
g_clear_pointer (&proc_frame->main_loop, g_main_loop_unref);
if (proc_frame->image_cleanups || proc_frame->item_cleanups)
gimp_plug_in_cleanup (plug_in, proc_frame);
if (proc_frame->procedure)
{
g_object_unref (proc_frame->procedure);
proc_frame->procedure = NULL;
}
g_clear_object (&proc_frame->procedure);
}
GimpPlugInProcFrame *

View File

@ -77,8 +77,7 @@ gimp_fonts_exit (Gimp *gimp)
G_CALLBACK (gimp_fonts_load),
gimp);
g_object_unref (gimp->fonts);
gimp->fonts = NULL;
g_clear_object (&gimp->fonts);
}
}

View File

@ -142,17 +142,8 @@ gimp_font_finalize (GObject *object)
{
GimpFont *font = GIMP_FONT (object);
if (font->pango_context)
{
g_object_unref (font->pango_context);
font->pango_context = NULL;
}
if (font->popup_layout)
{
g_object_unref (font->popup_layout);
font->popup_layout = NULL;
}
g_clear_object (&font->pango_context);
g_clear_object (&font->popup_layout);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@ -192,11 +192,7 @@ gimp_text_layer_finalize (GObject *object)
{
GimpTextLayer *layer = GIMP_TEXT_LAYER (object);
if (layer->text)
{
g_object_unref (layer->text);
layer->text = NULL;
}
g_clear_object (&layer->text);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -472,8 +468,7 @@ gimp_text_layer_set_text (GimpTextLayer *layer,
G_CALLBACK (gimp_text_layer_text_changed),
layer);
g_object_unref (layer->text);
layer->text = NULL;
g_clear_object (&layer->text);
}
if (text)

View File

@ -292,11 +292,7 @@ gimp_text_undo_free (GimpUndo *undo,
{
GimpTextUndo *text_undo = GIMP_TEXT_UNDO (undo);
if (text_undo->text)
{
g_object_unref (text_undo->text);
text_undo->text = NULL;
}
g_clear_object (&text_undo->text);
if (text_undo->pspec)
{

Some files were not shown because too many files have changed in this diff Show More