Independent Samples T-Test Dialog: Fix Crash
authorJohn Darrington <john@cellform.com>
Mon, 3 Feb 2025 16:27:05 +0000 (17:27 +0100)
committerJohn Darrington <john@cellform.com>
Mon, 3 Feb 2025 16:34:05 +0000 (17:34 +0100)
Only unref the existing grouping variable, if the new one is non-null.
Otherwise it gets unreffed too many times.

Fixes bug 66747

src/language/commands/glm.c
src/ui/gui/psppire-dialog-action-indep-samps.c

index 077fecc5281ce82e79098734ac9509e70381da8e..9d302000762d94e8546905983ebb4b50ae40dfeb 100644 (file)
@@ -45,6 +45,7 @@
 #include "math/moments.h"
 #include "output/pivot-table.h"
 
+#include <locale.h>
 #include "gettext.h"
 #define N_(msgid) msgid
 #define _(msgid) gettext (msgid)
index 17f81271b45b6d30197a7f084399d8923f52cdde..f4a32781975dc789fb58327c12ffad73f1ea96f5 100644 (file)
@@ -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;
 }
-