diff options
author | rbuj <[email protected]> | 2020-02-02 08:06:38 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2020-03-25 13:39:20 +0100 |
commit | e96ec69bd2fd1a2aa1032756a3d52d6d4d372d12 (patch) | |
tree | 9399f8248492fe378f12ffa7820fd317644dcf84 /image-converter | |
parent | 7fdb280466fa41e94214c18db0a273e7a74ec3c7 (diff) | |
download | caja-extensions-e96ec69bd2fd1a2aa1032756a3d52d6d4d372d12.tar.bz2 caja-extensions-e96ec69bd2fd1a2aa1032756a3d52d6d4d372d12.tar.xz |
Fix memory leak allocated with 'gtk_builder_new ()'
Diffstat (limited to 'image-converter')
-rw-r--r-- | image-converter/caja-image-resizer.c | 34 | ||||
-rw-r--r-- | image-converter/caja-image-rotator.c | 28 |
2 files changed, 31 insertions, 31 deletions
diff --git a/image-converter/caja-image-resizer.c b/image-converter/caja-image-resizer.c index 63a0599..cf17cb2 100644 --- a/image-converter/caja-image-resizer.c +++ b/image-converter/caja-image-resizer.c @@ -336,35 +336,33 @@ caja_image_resizer_init(CajaImageResizer *resizer) { CajaImageResizerPrivate *priv = caja_image_resizer_get_instance_private (resizer); - GtkBuilder *ui; + GtkBuilder *builder; GError *err = NULL; - /* Let's create our gtkbuilder and load the xml file */ - ui = gtk_builder_new (); - gtk_builder_set_translation_domain (ui, GETTEXT_PACKAGE); - + builder = gtk_builder_new (); + gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE); /* If we're unable to load the xml file */ - if (gtk_builder_add_from_resource (ui, "/org/mate/caja/extensions/imageconverter/caja-image-resize.ui", &err) == 0) { + if (gtk_builder_add_from_resource (builder, "/org/mate/caja/extensions/imageconverter/caja-image-resize.ui", &err) == 0) { g_warning ("%s", err->message); g_error_free (err); return; } /* Grab some widgets */ - priv->resize_dialog = GTK_DIALOG (gtk_builder_get_object (ui, "resize_dialog")); + priv->resize_dialog = GTK_DIALOG (gtk_builder_get_object (builder, "resize_dialog")); priv->default_size_radiobutton = - GTK_RADIO_BUTTON (gtk_builder_get_object (ui, "default_size_radiobutton")); - priv->size_combobox = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (ui, "comboboxtext_size")); + GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "default_size_radiobutton")); + priv->size_combobox = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (builder, "comboboxtext_size")); priv->custom_pct_radiobutton = - GTK_RADIO_BUTTON (gtk_builder_get_object (ui, "custom_pct_radiobutton")); - priv->pct_spinbutton = GTK_SPIN_BUTTON (gtk_builder_get_object (ui, "pct_spinbutton")); + GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "custom_pct_radiobutton")); + priv->pct_spinbutton = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "pct_spinbutton")); priv->custom_size_radiobutton = - GTK_RADIO_BUTTON (gtk_builder_get_object (ui, "custom_size_radiobutton")); - priv->width_spinbutton = GTK_SPIN_BUTTON (gtk_builder_get_object (ui, "width_spinbutton")); - priv->height_spinbutton = GTK_SPIN_BUTTON (gtk_builder_get_object (ui, "height_spinbutton")); - priv->append_radiobutton = GTK_RADIO_BUTTON (gtk_builder_get_object (ui, "append_radiobutton")); - priv->name_entry = GTK_ENTRY (gtk_builder_get_object (ui, "name_entry")); - priv->inplace_radiobutton = GTK_RADIO_BUTTON (gtk_builder_get_object (ui, "inplace_radiobutton")); + GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "custom_size_radiobutton")); + priv->width_spinbutton = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "width_spinbutton")); + priv->height_spinbutton = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "height_spinbutton")); + priv->append_radiobutton = GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "append_radiobutton")); + priv->name_entry = GTK_ENTRY (gtk_builder_get_object (builder, "name_entry")); + priv->inplace_radiobutton = GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "inplace_radiobutton")); /* Set default item in combo box */ /* gtk_combo_box_set_active (priv->size_combobox, 4); 1024x768 */ @@ -373,6 +371,8 @@ caja_image_resizer_init(CajaImageResizer *resizer) g_signal_connect (G_OBJECT (priv->resize_dialog), "response", (GCallback) caja_image_resizer_response_cb, resizer); + + g_object_unref (builder); } CajaImageResizer * diff --git a/image-converter/caja-image-rotator.c b/image-converter/caja-image-rotator.c index 733d971..fca0f8e 100644 --- a/image-converter/caja-image-rotator.c +++ b/image-converter/caja-image-rotator.c @@ -347,34 +347,32 @@ caja_image_rotator_init(CajaImageRotator *rotator) { CajaImageRotatorPrivate *priv = caja_image_rotator_get_instance_private (rotator); - GtkBuilder *ui; + GtkBuilder *builder; GError *err = NULL; - /* Let's create our gtkbuilder and load the xml file */ - ui = gtk_builder_new (); - gtk_builder_set_translation_domain (ui, GETTEXT_PACKAGE); - + builder = gtk_builder_new (); + gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE); /* If we're unable to load the xml file */ - if (gtk_builder_add_from_resource (ui, "/org/mate/caja/extensions/imageconverter/caja-image-rotate.ui", &err) == 0) { + if (gtk_builder_add_from_resource (builder, "/org/mate/caja/extensions/imageconverter/caja-image-rotate.ui", &err) == 0) { g_warning ("%s", err->message); g_error_free (err); return; } /* Grab some widgets */ - priv->rotate_dialog = GTK_DIALOG (gtk_builder_get_object (ui, "rotate_dialog")); + priv->rotate_dialog = GTK_DIALOG (gtk_builder_get_object (builder, "rotate_dialog")); priv->default_angle_radiobutton = - GTK_RADIO_BUTTON (gtk_builder_get_object (ui, "default_angle_radiobutton")); - priv->angle_combobox = GTK_COMBO_BOX (gtk_builder_get_object (ui, "angle_combobox")); + GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "default_angle_radiobutton")); + priv->angle_combobox = GTK_COMBO_BOX (gtk_builder_get_object (builder, "angle_combobox")); priv->custom_angle_radiobutton = - GTK_RADIO_BUTTON (gtk_builder_get_object (ui, "custom_angle_radiobutton")); + GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "custom_angle_radiobutton")); priv->angle_spinbutton = - GTK_SPIN_BUTTON (gtk_builder_get_object (ui, "angle_spinbutton")); + GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "angle_spinbutton")); priv->append_radiobutton = - GTK_RADIO_BUTTON (gtk_builder_get_object (ui, "append_radiobutton")); - priv->name_entry = GTK_ENTRY (gtk_builder_get_object (ui, "name_entry")); + GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "append_radiobutton")); + priv->name_entry = GTK_ENTRY (gtk_builder_get_object (builder, "name_entry")); priv->inplace_radiobutton = - GTK_RADIO_BUTTON (gtk_builder_get_object (ui, "inplace_radiobutton")); + GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "inplace_radiobutton")); /* Set default value for combobox */ gtk_combo_box_set_active (priv->angle_combobox, 0); /* 90° clockwise */ @@ -383,6 +381,8 @@ caja_image_rotator_init(CajaImageRotator *rotator) g_signal_connect (G_OBJECT (priv->rotate_dialog), "response", (GCallback) caja_image_rotator_response_cb, rotator); + + g_object_unref (builder); } CajaImageRotator * |