mirror of https://github.com/GNOME/gimp.git
libgimp*: use some g_clear_object() and g_clear_pointer()
This commit is contained in:
parent
4cfeb53d09
commit
582c6edd54
|
@ -206,7 +206,7 @@ gimp_proc_browser_dialog_init (GimpProcBrowserDialog *dialog)
|
|||
parent = gtk_widget_get_parent (GIMP_BROWSER (dialog->browser)->right_vbox);
|
||||
parent = gtk_widget_get_parent (parent);
|
||||
|
||||
gtk_widget_set_size_request (parent, DBL_WIDTH - DBL_LIST_WIDTH, -1);
|
||||
gtk_widget_set_size_request (parent, DBL_WIDTH - DBL_LIST_WIDTH, -1);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -269,11 +269,7 @@ gimp_zoom_preview_finalize (GObject *object)
|
|||
{
|
||||
GimpZoomPreviewPrivate *priv = GIMP_ZOOM_PREVIEW_GET_PRIVATE (object);
|
||||
|
||||
if (priv->model)
|
||||
{
|
||||
g_object_unref (priv->model);
|
||||
priv->model = NULL;
|
||||
}
|
||||
g_clear_object (&priv->model);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -149,25 +149,17 @@ gimp_color_profile_finalize (GObject *object)
|
|||
{
|
||||
GimpColorProfile *profile = GIMP_COLOR_PROFILE (object);
|
||||
|
||||
if (profile->priv->lcms_profile)
|
||||
{
|
||||
cmsCloseProfile (profile->priv->lcms_profile);
|
||||
profile->priv->lcms_profile = NULL;
|
||||
}
|
||||
g_clear_pointer (&profile->priv->lcms_profile, cmsCloseProfile);
|
||||
|
||||
if (profile->priv->data)
|
||||
{
|
||||
g_free (profile->priv->data);
|
||||
profile->priv->data = NULL;
|
||||
profile->priv->length = 0;
|
||||
}
|
||||
g_clear_pointer (&profile->priv->data, g_free);
|
||||
profile->priv->length = 0;
|
||||
|
||||
g_free (profile->priv->description);
|
||||
g_free (profile->priv->manufacturer);
|
||||
g_free (profile->priv->model);
|
||||
g_free (profile->priv->copyright);
|
||||
g_free (profile->priv->label);
|
||||
g_free (profile->priv->summary);
|
||||
g_clear_pointer (&profile->priv->description, g_free);
|
||||
g_clear_pointer (&profile->priv->manufacturer, g_free);
|
||||
g_clear_pointer (&profile->priv->model, g_free);
|
||||
g_clear_pointer (&profile->priv->copyright, g_free);
|
||||
g_clear_pointer (&profile->priv->label, g_free);
|
||||
g_clear_pointer (&profile->priv->summary, g_free);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -148,23 +148,10 @@ gimp_color_transform_finalize (GObject *object)
|
|||
{
|
||||
GimpColorTransform *transform = GIMP_COLOR_TRANSFORM (object);
|
||||
|
||||
if (transform->priv->src_profile)
|
||||
{
|
||||
g_object_unref (transform->priv->src_profile);
|
||||
transform->priv->src_profile = NULL;
|
||||
}
|
||||
g_clear_object (&transform->priv->src_profile);
|
||||
g_clear_object (&transform->priv->dest_profile);
|
||||
|
||||
if (transform->priv->dest_profile)
|
||||
{
|
||||
g_object_unref (transform->priv->dest_profile);
|
||||
transform->priv->dest_profile = NULL;
|
||||
}
|
||||
|
||||
if (transform->priv->transform)
|
||||
{
|
||||
cmsDeleteTransform (transform->priv->transform);
|
||||
transform->priv->transform = NULL;
|
||||
}
|
||||
g_clear_pointer (&transform->priv->transform, cmsDeleteTransform);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -186,23 +186,10 @@ gimp_cell_renderer_toggle_finalize (GObject *object)
|
|||
GimpCellRendererToggle *toggle = GIMP_CELL_RENDERER_TOGGLE (object);
|
||||
GimpCellRendererTogglePrivate *priv = GET_PRIVATE (object);
|
||||
|
||||
if (priv->icon_name)
|
||||
{
|
||||
g_free (priv->icon_name);
|
||||
priv->icon_name = NULL;
|
||||
}
|
||||
g_clear_pointer (&priv->icon_name, g_free);
|
||||
g_clear_pointer (&toggle->stock_id, g_free);
|
||||
|
||||
if (toggle->stock_id)
|
||||
{
|
||||
g_free (toggle->stock_id);
|
||||
toggle->stock_id = NULL;
|
||||
}
|
||||
|
||||
if (toggle->pixbuf)
|
||||
{
|
||||
g_object_unref (toggle->pixbuf);
|
||||
toggle->pixbuf = NULL;
|
||||
}
|
||||
g_clear_object (&toggle->pixbuf);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
@ -276,11 +263,7 @@ gimp_cell_renderer_toggle_set_property (GObject *object,
|
|||
break;
|
||||
}
|
||||
|
||||
if (toggle->pixbuf)
|
||||
{
|
||||
g_object_unref (toggle->pixbuf);
|
||||
toggle->pixbuf = NULL;
|
||||
}
|
||||
g_clear_object (&toggle->pixbuf);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -526,8 +509,7 @@ gimp_cell_renderer_toggle_create_pixbuf (GimpCellRendererToggle *toggle,
|
|||
{
|
||||
GimpCellRendererTogglePrivate *priv = GET_PRIVATE (toggle);
|
||||
|
||||
if (toggle->pixbuf)
|
||||
g_object_unref (toggle->pixbuf);
|
||||
g_clear_object (&toggle->pixbuf);
|
||||
|
||||
if (priv->icon_name)
|
||||
{
|
||||
|
|
|
@ -267,11 +267,7 @@ gimp_color_area_finalize (GObject *object)
|
|||
{
|
||||
GimpColorArea *area = GIMP_COLOR_AREA (object);
|
||||
|
||||
if (area->buf)
|
||||
{
|
||||
g_free (area->buf);
|
||||
area->buf = NULL;
|
||||
}
|
||||
g_clear_pointer (&area->buf, g_free);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
@ -959,11 +955,7 @@ gimp_color_area_destroy_transform (GimpColorArea *area)
|
|||
{
|
||||
GimpColorAreaPrivate *priv = GET_PRIVATE (area);
|
||||
|
||||
if (priv->transform)
|
||||
{
|
||||
g_object_unref (priv->transform);
|
||||
priv->transform = NULL;
|
||||
}
|
||||
g_clear_object (&priv->transform);
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (area));
|
||||
}
|
||||
|
|
|
@ -406,11 +406,7 @@ gimp_color_button_finalize (GObject *object)
|
|||
{
|
||||
GimpColorButton *button = GIMP_COLOR_BUTTON (object);
|
||||
|
||||
if (button->title)
|
||||
{
|
||||
g_free (button->title);
|
||||
button->title = NULL;
|
||||
}
|
||||
g_clear_pointer (&button->title, g_free);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
@ -421,24 +417,12 @@ gimp_color_button_dispose (GObject *object)
|
|||
GimpColorButton *button = GIMP_COLOR_BUTTON (object);
|
||||
GimpColorButtonPrivate *priv = GET_PRIVATE (button);
|
||||
|
||||
if (button->dialog)
|
||||
{
|
||||
gtk_widget_destroy (button->dialog);
|
||||
button->dialog = NULL;
|
||||
priv->selection = NULL;
|
||||
}
|
||||
g_clear_pointer (&button->dialog, gtk_widget_destroy);
|
||||
priv->selection = NULL;
|
||||
|
||||
if (button->color_area)
|
||||
{
|
||||
gtk_widget_destroy (button->color_area);
|
||||
button->color_area = NULL;
|
||||
}
|
||||
g_clear_pointer (&button->color_area, gtk_widget_destroy);
|
||||
|
||||
if (button->popup_menu)
|
||||
{
|
||||
g_object_unref (button->popup_menu);
|
||||
button->popup_menu = NULL;
|
||||
}
|
||||
g_clear_object (&button->popup_menu);
|
||||
|
||||
gimp_color_button_set_color_config (button, NULL);
|
||||
|
||||
|
|
|
@ -177,11 +177,7 @@ gimp_color_profile_combo_box_finalize (GObject *object)
|
|||
|
||||
priv = GIMP_COLOR_PROFILE_COMBO_BOX_GET_PRIVATE (combo);
|
||||
|
||||
if (priv->last_path)
|
||||
{
|
||||
gtk_tree_path_free (priv->last_path);
|
||||
priv->last_path = NULL;
|
||||
}
|
||||
g_clear_pointer (&priv->last_path, gtk_tree_path_free);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -171,11 +171,7 @@ gimp_color_profile_store_finalize (GObject *object)
|
|||
{
|
||||
GimpColorProfileStore *store = GIMP_COLOR_PROFILE_STORE (object);
|
||||
|
||||
if (store->history)
|
||||
{
|
||||
g_free (store->history);
|
||||
store->history = NULL;
|
||||
}
|
||||
g_clear_pointer (&store->history, g_free);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -104,11 +104,7 @@ gimp_color_profile_view_finalize (GObject *object)
|
|||
{
|
||||
GimpColorProfileView *view = GIMP_COLOR_PROFILE_VIEW (object);
|
||||
|
||||
if (view->priv->profile)
|
||||
{
|
||||
g_object_unref (view->priv->profile);
|
||||
view->priv->profile = NULL;
|
||||
}
|
||||
g_clear_object (&view->priv->profile);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -201,14 +201,10 @@ gimp_color_scale_finalize (GObject *object)
|
|||
{
|
||||
GimpColorScale *scale = GIMP_COLOR_SCALE (object);
|
||||
|
||||
if (scale->buf)
|
||||
{
|
||||
g_free (scale->buf);
|
||||
scale->buf = NULL;
|
||||
scale->width = 0;
|
||||
scale->height = 0;
|
||||
scale->rowstride = 0;
|
||||
}
|
||||
g_clear_pointer (&scale->buf, g_free);
|
||||
scale->width = 0;
|
||||
scale->height = 0;
|
||||
scale->rowstride = 0;
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -460,23 +460,15 @@ gimp_color_select_finalize (GObject *object)
|
|||
{
|
||||
GimpColorSelect *select = GIMP_COLOR_SELECT (object);
|
||||
|
||||
if (select->xy_buf)
|
||||
{
|
||||
g_free (select->xy_buf);
|
||||
select->xy_buf = NULL;
|
||||
select->xy_width = 0;
|
||||
select->xy_height = 0;
|
||||
select->xy_rowstride = 0;
|
||||
}
|
||||
g_clear_pointer (&select->xy_buf, g_free);
|
||||
select->xy_width = 0;
|
||||
select->xy_height = 0;
|
||||
select->xy_rowstride = 0;
|
||||
|
||||
if (select->z_buf)
|
||||
{
|
||||
g_free (select->z_buf);
|
||||
select->z_buf = NULL;
|
||||
select->z_width = 0;
|
||||
select->z_height = 0;
|
||||
select->z_rowstride = 0;
|
||||
}
|
||||
g_clear_pointer (&select->z_buf, g_free);
|
||||
select->z_width = 0;
|
||||
select->z_height = 0;
|
||||
select->z_rowstride = 0;
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -218,11 +218,7 @@ gimp_dialog_finalize (GObject *object)
|
|||
{
|
||||
GimpDialogPrivate *private = GET_PRIVATE (object);
|
||||
|
||||
if (private->help_id)
|
||||
{
|
||||
g_free (private->help_id);
|
||||
private->help_id = NULL;
|
||||
}
|
||||
g_clear_pointer (&private->help_id, g_free);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -185,17 +185,9 @@ gimp_file_entry_dispose (GObject *object)
|
|||
{
|
||||
GimpFileEntry *entry = GIMP_FILE_ENTRY (object);
|
||||
|
||||
if (entry->file_dialog)
|
||||
{
|
||||
gtk_widget_destroy (entry->file_dialog);
|
||||
entry->file_dialog = NULL;
|
||||
}
|
||||
g_clear_pointer (&entry->file_dialog, gtk_widget_destroy);
|
||||
|
||||
if (entry->title)
|
||||
{
|
||||
g_free (entry->title);
|
||||
entry->title = NULL;
|
||||
}
|
||||
g_clear_pointer (&entry->title, g_free);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
|
|
@ -154,11 +154,7 @@ gimp_int_combo_box_finalize (GObject *object)
|
|||
{
|
||||
GimpIntComboBoxPrivate *priv = GIMP_INT_COMBO_BOX_GET_PRIVATE (object);
|
||||
|
||||
if (priv->label)
|
||||
{
|
||||
g_free (priv->label);
|
||||
priv->label = NULL;
|
||||
}
|
||||
g_clear_pointer (&priv->label, g_free);
|
||||
|
||||
if (priv->sensitivity_destroy)
|
||||
{
|
||||
|
|
|
@ -106,11 +106,7 @@ gimp_memsize_entry_finalize (GObject *object)
|
|||
{
|
||||
GimpMemsizeEntry *entry = (GimpMemsizeEntry *) object;
|
||||
|
||||
if (entry->adjustment)
|
||||
{
|
||||
g_object_unref (entry->adjustment);
|
||||
entry->adjustment = NULL;
|
||||
}
|
||||
g_clear_object (&entry->adjustment);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -341,8 +341,7 @@ gimp_page_selector_finalize (GObject *object)
|
|||
{
|
||||
GimpPageSelectorPrivate *priv = GIMP_PAGE_SELECTOR_GET_PRIVATE (object);
|
||||
|
||||
if (priv->default_thumbnail)
|
||||
g_object_unref (priv->default_thumbnail);
|
||||
g_clear_object (&priv->default_thumbnail);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -175,17 +175,8 @@ gimp_preview_area_finalize (GObject *object)
|
|||
{
|
||||
GimpPreviewArea *area = GIMP_PREVIEW_AREA (object);
|
||||
|
||||
if (area->buf)
|
||||
{
|
||||
g_free (area->buf);
|
||||
area->buf = NULL;
|
||||
}
|
||||
|
||||
if (area->colormap)
|
||||
{
|
||||
g_free (area->colormap);
|
||||
area->colormap = NULL;
|
||||
}
|
||||
g_clear_pointer (&area->buf, g_free);
|
||||
g_clear_pointer (&area->colormap, g_free);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -811,25 +811,12 @@ gimp_ruler_unrealize (GtkWidget *widget)
|
|||
GimpRuler *ruler = GIMP_RULER (widget);
|
||||
GimpRulerPrivate *priv = GIMP_RULER_GET_PRIVATE (ruler);
|
||||
|
||||
if (priv->backing_store)
|
||||
{
|
||||
cairo_surface_destroy (priv->backing_store);
|
||||
priv->backing_store = NULL;
|
||||
}
|
||||
|
||||
g_clear_pointer (&priv->backing_store, cairo_surface_destroy);
|
||||
priv->backing_store_valid = FALSE;
|
||||
|
||||
if (priv->layout)
|
||||
{
|
||||
g_object_unref (priv->layout);
|
||||
priv->layout = NULL;
|
||||
}
|
||||
g_clear_object (&priv->layout);
|
||||
|
||||
if (priv->input_window)
|
||||
{
|
||||
gdk_window_destroy (priv->input_window);
|
||||
priv->input_window = NULL;
|
||||
}
|
||||
g_clear_pointer (&priv->input_window, gdk_window_destroy);
|
||||
|
||||
GTK_WIDGET_CLASS (gimp_ruler_parent_class)->unrealize (widget);
|
||||
}
|
||||
|
@ -924,11 +911,7 @@ gimp_ruler_style_set (GtkWidget *widget,
|
|||
|
||||
priv->backing_store_valid = FALSE;
|
||||
|
||||
if (priv->layout)
|
||||
{
|
||||
g_object_unref (priv->layout);
|
||||
priv->layout = NULL;
|
||||
}
|
||||
g_clear_object (&priv->layout);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -132,11 +132,7 @@ gimp_unit_menu_finalize (GObject *object)
|
|||
{
|
||||
GimpUnitMenu *menu = GIMP_UNIT_MENU (object);
|
||||
|
||||
if (menu->format)
|
||||
{
|
||||
g_free (menu->format);
|
||||
menu->format = NULL;
|
||||
}
|
||||
g_clear_pointer (&menu->format, g_free);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue