From 53a77fc6d950849af8fa98e89a6e9cb6d1281891 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 12 Mar 2005 21:19:53 +0000 Subject: [PATCH] Fix PR 11492. --- src/ChangeLog | 5 ++ src/vfm.c | 6 ++- tests/ChangeLog | 4 ++ tests/Makefile.am | 1 + tests/bugs/temp-freq.sh | 110 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 124 insertions(+), 2 deletions(-) create mode 100755 tests/bugs/temp-freq.sh diff --git a/src/ChangeLog b/src/ChangeLog index 0fceb282..6073c81b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +Sat Mar 12 13:17:12 2005 Ben Pfaff + + * vfm.c: (procedure_with_splits) Fix PR 11492: end_func() must be + called *before* close_active_file(). + Sat Mar 12 12:20:57 2005 Ben Pfaff * file-handle.q: (struct file_handle) Change open_mode from diff --git a/src/vfm.c b/src/vfm.c index 796e3bcf..8e939277 100644 --- a/src/vfm.c +++ b/src/vfm.c @@ -783,10 +783,12 @@ procedure_with_splits (void (*begin_func) (void *aux), split_aux.end_func = end_func; split_aux.func_aux = func_aux; - procedure (procedure_with_splits_callback, &split_aux); - + open_active_file (); + internal_procedure (procedure_with_splits_callback, &split_aux); if (split_aux.case_count > 0 && end_func != NULL) end_func (func_aux); + close_active_file (); + case_destroy (&split_aux.prev_case); } diff --git a/tests/ChangeLog b/tests/ChangeLog index 3a9a93da..26fdf957 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,7 @@ +Sat Mar 12 13:16:34 2005 Ben Pfaff + + * bugs/temp-freq.sh: Add another test. + Fri Mar 11 10:40:41 2005 Ben Pfaff * expressions/expressions.sh: Add another test. diff --git a/tests/Makefile.am b/tests/Makefile.am index 62b80609..d018e19e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -70,6 +70,7 @@ TESTS = \ bugs/val-labs-trailing-slash.sh \ bugs/recode-copy-bug.sh \ bugs/computebug.sh \ + bugs/temp-freq.sh \ xforms/casefile.sh \ stats/descript-basic.sh \ stats/descript-missing.sh \ diff --git a/tests/bugs/temp-freq.sh b/tests/bugs/temp-freq.sh new file mode 100755 index 00000000..d2c10614 --- /dev/null +++ b/tests/bugs/temp-freq.sh @@ -0,0 +1,110 @@ +#!/bin/sh + +# This program tests for a bug which caused FREQUENCIES following +# TEMPORARY to crash (PR 11492). + +TEMPDIR=/tmp/pspp-tst-$$ +TESTFILE=$TEMPDIR/`basename $0`.sps + +here=`pwd`; + +# ensure that top_srcdir is absolute +cd $top_srcdir; top_srcdir=`pwd` + +export STAT_CONFIG_PATH=$top_srcdir/config + + +cleanup() +{ + rm -rf $TEMPDIR +} + + +fail() +{ + echo $activity + echo FAILED + cleanup; + exit 1; +} + + +no_result() +{ + echo $activity + echo NO RESULT; + cleanup; + exit 2; +} + +pass() +{ + cleanup; + exit 0; +} + +mkdir -p $TEMPDIR + +cd $TEMPDIR + +activity="create program" +cat > $TESTFILE <