John Darrington <j...@darrington.wattle.id.au> writes:

> From 4c2e195ca63240c1f6ad9b6b75d761f54ee94f77 Mon Sep 17 00:00:00 2001
> From: John Darrington <j...@darrington.wattle.id.au>
> 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.

_______________________________________________
pspp-dev mailing list
pspp-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/pspp-dev

Reply via email to