pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Minor(ish) changes to PsppireValueEntry


From: Ben Pfaff
Subject: Re: Minor(ish) changes to PsppireValueEntry
Date: Mon, 23 Apr 2012 21:14:36 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

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.  Otherwise we'll leak
the final model set before the PsppireValueEntry is finalized.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]