John Darrington [Thu, 9 May 2013 09:28:12 +0000 (11:28 +0200)]
Fix stack corruption in ODS reader.
zip_reader_create takes a pointer to a struct string, which
is used to store error messages during zip operations. I had
been passing the address of a string declared as local variable
in ods_probe. However since the zip reader survives ods_probe,
this caused stack corruption in later read operations.
This change makes the string a member of the reader created (if any).
John Darrington [Tue, 7 May 2013 13:52:44 +0000 (15:52 +0200)]
Spreadsheetreader: new function create_cell_ref and rename existing function with that name.
Rename convert_cell_ref to convert_cell_range which is a more accurate
description of the function, and add a new function, with the original
name of the function we've just renamed.
The new function (create_cell_ref) does just that.
Ben Pfaff [Thu, 9 May 2013 04:07:39 +0000 (21:07 -0700)]
psppire-cell-renderer-button: Do not update 'event->window'.
Commit 5b59146f8d0 (psppire-cell-renderer-button: Translate coords before
propagating event.) caused GDK and GTK+ warnings and criticals and a crash
if the scenario described in the bug report were repeated a number of
times. This change appears to fix the problem.
Ben Pfaff [Wed, 8 May 2013 05:29:50 +0000 (22:29 -0700)]
psppire-cell-renderer-button: Translate coords before propagating event.
When propagating a right-click upward, the x and y coordinates in the
event are those for the button, not for the parent window, but the parent
window's signal handlers will expect that they are relative to the parent
window. This commit makes that so.
Without this commit, the following scenario occurs:
1. Open a dataset with at least two cases.
2. Switch to the Data View
3. Place the pointer over (say) the tenth row header button.
4. Click the left mouse button.
5. Click the right mouse button.
6. The popup menu appears (as it should), but row 1 gets selected instead
of row 10.
With this commit, in step 6 the correct row is selected.
Ben Pfaff [Mon, 6 May 2013 04:48:06 +0000 (21:48 -0700)]
psppire-window: Disconnect signal handlers before unregistering.
Otherwise, the call to psppire_window_register_remove() calls back into
remove_menuitem() via the "remove" signal, but window->menu referenced in
that callback has already been freed.
Ben Pfaff [Mon, 6 May 2013 04:39:16 +0000 (21:39 -0700)]
psppire-data-sheet: Disconnect clipboard owner-change signal on dispose.
Otherwise, any clipboard change in ownership (e.g. clicking on some cells
and typing Control+C), even after a given PsppireDataSheet closes, still
calls into on_owner_change() and commits a use-after-free error.
Ben Pfaff [Mon, 6 May 2013 01:04:03 +0000 (18:04 -0700)]
psppire-data-sheet: Obtain data sheet targets via callback.
Calling gtk_clipboard_wait_is_target_available() within on_owner_change()
seems to cause Window|Split to act oddly (the right panes were empty),
perhaps because gtk_clipboard_wait_is_target_available() has a nested main
loop. Switching to gtk_clipboard_request_targets() fixes the problem.
John Darrington [Mon, 29 Apr 2013 11:40:06 +0000 (13:40 +0200)]
list.c Use "long" instead of "int" for command parameters.
Commit 4e5a6cc044c6c82e6c4d842bf056579b6bc47d48 used int instead of long for the
parameters of the LIST command. This caused compiler warnings and problems on
64 bit machines. This change fixes that.
John Darrington [Sun, 28 Apr 2013 07:15:28 +0000 (09:15 +0200)]
Fix recently introduces bug in LIST /CASES
Commit 4e5a6cc044c6c82e6c4d842bf056579b6bc47d48 contained a bug. This change
corrects the bug, and updates a test, such that the bug will be caught, should
it ever reappear.
Ben Pfaff [Fri, 26 Apr 2013 06:03:45 +0000 (23:03 -0700)]
FLIP: Fix use-after-free error with temporary transformations.
The FLIP procedure keeps a reference to the dictionary from before running
a procedure and then uses that reference after calling proc_commit(). When
temporary transformations are present, this dictionary disappears. The
"SPLIT FILE - vs procedures" test triggers this issue because it uses
FILTER, which is implemented as a temporary transformation.
This commit fixes the problem by avoiding a reference to the old
dictionary after proc_commit().
Ben Pfaff [Thu, 25 Apr 2013 05:26:06 +0000 (22:26 -0700)]
u8-istream: Fix reading UTF-16 and UTF-32 files.
Before this commit, u8_istream_for_fd() would obtain the correct encoding
from encoding_guess_head_encoding() for UTF-16 and UTF-32 files, and then
it would ignore it and use the default encoding returned by
encoding_guess_parse_encoding(). This commit fixes the problem.
John Darrington [Sun, 14 Apr 2013 11:36:42 +0000 (13:36 +0200)]
Terminal reader: Interruptable command line interface
This change alters the behaviour of the command line interface such that
upon receiving SIGINT, instead of immediately aborting, the current command
being read will be interrupted and a new PSPP> prompt appears.
Ben Pfaff [Sun, 7 Apr 2013 22:06:35 +0000 (15:06 -0700)]
AUTORECODE: Avoid use-after-free error with TEMPORARY.
When TEMPORARY is in effect, proc_commit() destroys the temporary
dictionary. This means that any procedure that does not somehow disable
temporary transformations and refers to a variable following proc_commit()
has a use-after-free error.
Until now, AUTORECODE had this problem. This commit fixes it and adds a
test.
Ben Pfaff [Sun, 7 Apr 2013 19:57:32 +0000 (12:57 -0700)]
ascii: Omit whitespace at the end of a line.
Long string variables tend not to be completely filled with data, which
means that they end in a lot of spaces. The ASCII output driver didn't
handle these well. Instead, it put a blank line in the cell for each
trailing space.
Ben Pfaff [Sun, 7 Apr 2013 17:06:23 +0000 (10:06 -0700)]
CORRELATIONS: Fix crash with separate sets of row and column variables.
When WITH is specified, the column variables start at offset corr->n_vars1
within corr->vars. The calculation previously used here was incorrect and
caused an access beyond the end of the corr->vars array.
The code would be clearer if there were separate row_vars and col_vars
arrays, but that would be a larger change.
Ben Pfaff [Thu, 4 Apr 2013 16:26:03 +0000 (11:26 -0500)]
RELIABILITY: Fix memory leaks and dereferences of uninitialized pointers.
The 'total' struct and 'm' array in struct reliability were allocated once
per case group, but freed exactly once. If there were no case groups,
this caused a null dereference. If there was more than one case group,
this caused a memory leak. This commit fixes both problems.
This commit also fixes a related crash on bad syntax due to dereferencing
a null pointer in reliability_destroy().
John Darrington [Mon, 1 Apr 2013 05:34:28 +0000 (07:34 +0200)]
Work-around bug in GCC 4.4.5
Gcc 4.4.5 seems to be buggy. For some reason it miscompiles the code in
casereader_count_cases__ when compiled with -O2 by not allocating enough
stack. This commit works around that problem by putting a dummy variable
on the stack.
John Darrington [Sun, 31 Mar 2013 17:27:34 +0000 (19:27 +0200)]
ONEWAY /POSTHOC: Annotate output with dependent variable
The Multiple Comparisons table did not specify the variable to which it refered. This could be confusing
if more than one variable was specified.
Fixes bug #38635
John Darrington [Fri, 29 Mar 2013 11:13:43 +0000 (12:13 +0100)]
Fix order of text-import subdialogs.
Commit 29c1450251805417aacb9cecc84b03c81137c137 inadvertently reversed the
order of display of the the first-line and seperator subdialogs. Amoung
other problems, this meant that controls of the former were no longer
respected. This change restores the original order.
John Darrington [Fri, 8 Mar 2013 13:03:12 +0000 (14:03 +0100)]
New module: psppire-spreadsheet-model.c
Provides an implementation of a GtkTreeModel which can be used to
display the meta data of Gnumeric or Opendocument spreadsheet files.
Potentially, other spreadsheet files could be added too.
Used for upcomming gui features.
Ben Pfaff [Sun, 3 Mar 2013 06:28:09 +0000 (22:28 -0800)]
pspp-sheet-view: Get rid of ctrl_pressed and shift_pressed.
Having these as member variables made it hard to keep key
press status separate from whether we want to extend or
toggle row selection. Most of the time, these are the
same, but there are some cases (e.g. Shift+Tab) where they
don't coincide, and an upcoming commit will add another
case.