value_destroy (&act->cut_point, width);
value_destroy (&act->grp_val[0], width);
value_destroy (&act->grp_val[1], width);
+ var_unref (act->grp_var);
act->grp_var = NULL;
act->grp_var_width = -1;
}
PsppireDialogAction *da = PSPPIRE_DIALOG_ACTION (act);
const gchar *text = gtk_entry_get_text (entry);
- const struct variable *v = da->dict ? psppire_dict_lookup_var (da->dict, text) : NULL;
+ struct variable *v = da->dict ? psppire_dict_lookup_var (da->dict, text) : NULL;
gtk_widget_set_sensitive (act->define_groups_button, v != NULL);
}
}
- act->grp_var = v;
+ struct variable *old_grp_var = act->grp_var;
+ if (v)
+ act->grp_var = var_ref (v);
+ if (old_grp_var)
+ var_unref (old_grp_var);
act->grp_var_width = v ? var_get_width (v) : -1;
}
GtkWidget *options_button;
/* The variable which determines to which group a datum belongs */
- const struct variable *grp_var;
+ struct variable *grp_var;
int grp_var_width;
/* The GtkEntry which holds the reference to the above variable */
*/
-/* Shallow copy the pointer */
static gpointer
variable_copy (gpointer var)
{
- return var;
+ struct variable *v = var;
+ return var_ref (v);
}
-/* Do nothing. It's a pointer only! */
static void
variable_free (gpointer var)
{
+ var_unref (var);
}