[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Minor(ish) changes to PsppireValueEntry
From: |
John Darrington |
Subject: |
Re: Minor(ish) changes to PsppireValueEntry |
Date: |
Tue, 24 Apr 2012 06:53:05 +0000 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
On Mon, Apr 23, 2012 at 09:14:36PM -0700, Ben Pfaff wrote:
John Darrington <address@hidden> writes:
> From 4c2e195ca63240c1f6ad9b6b75d761f54ee94f77 Mon Sep 17 00:00:00 2001
> From: John Darrington <address@hidden>
> Date: Mon, 23 Apr 2012 21:12:04 +0200
> Subject: [PATCH 3/5] PsppireValueEntry: unref old model before setting
the new one
>
> diff --git a/src/ui/gui/psppire-value-entry.c
b/src/ui/gui/psppire-value-entry.c
> index 85dbaa0..44ad2d0 100644
> --- a/src/ui/gui/psppire-value-entry.c
> +++ b/src/ui/gui/psppire-value-entry.c
> @@ -278,6 +278,8 @@ psppire_value_entry_refresh_model (PsppireValueEntry
*obj)
> GtkEntry *entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (obj)));
> gtk_entry_set_text (entry, "");
> }
> + else if (old_model)
> + g_object_unref (old_model);
>
> gtk_combo_box_set_model (GTK_COMBO_BOX (obj), model);
> gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (obj),
COL_LABEL);
I think that we should unref the new model, e.g. instead add:
if (model != NULL)
g_object_unref (model);
after the gtk_combo_box_set_model() call.
Unless gtk_combo_box_set_model takes a reference to the model, which I don't
think it does,
then this will cause the model to be immediately destroyed.
Otherwise we'll leak
the final model set before the PsppireValueEntry is finalized.
True. We could add a dispose routine to unref it.
J'
--
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3
See http://keys.gnupg.net or any PGP keyserver for public key.
signature.asc
Description: Digital signature
Re: Minor(ish) changes to PsppireValueEntry, John Darrington, 2012/04/24