From: John Darrington Date: Mon, 3 Feb 2025 16:27:05 +0000 (+0100) Subject: Independent Samples T-Test Dialog: Fix Crash X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bd3f683c75fc59f886222138bcfcdf0d9b2932d9;p=pspp Independent Samples T-Test Dialog: Fix Crash Only unref the existing grouping variable, if the new one is non-null. Otherwise it gets unreffed too many times. Fixes bug 66747 --- diff --git a/src/language/commands/glm.c b/src/language/commands/glm.c index 077fecc528..9d30200076 100644 --- a/src/language/commands/glm.c +++ b/src/language/commands/glm.c @@ -45,6 +45,7 @@ #include "math/moments.h" #include "output/pivot-table.h" +#include #include "gettext.h" #define N_(msgid) msgid #define _(msgid) gettext (msgid) diff --git a/src/ui/gui/psppire-dialog-action-indep-samps.c b/src/ui/gui/psppire-dialog-action-indep-samps.c index 17f81271b4..f4a3278197 100644 --- a/src/ui/gui/psppire-dialog-action-indep-samps.c +++ b/src/ui/gui/psppire-dialog-action-indep-samps.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2007, 2009, 2010, 2011, 2012, 2016 Free Software Foundation + Copyright (C) 2007, 2009, 2010, 2011, 2012, 2016, 2025 Free Software Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -275,13 +275,12 @@ on_grp_var_change (GtkEntry *entry, PsppireDialogActionIndepSamps *act) act->grp_val[0].s[0] = '\0'; act->grp_val[1].s[0] = '\0'; } - } - 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); + struct variable *old_grp_var = act->grp_var; + 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; } @@ -433,4 +432,3 @@ psppire_dialog_action_indep_samps_init (PsppireDialogActionIndepSamps *act) act->grp_var_width = -1; act->group_defn = GROUPS_UNDEF; } -