psppire-dict: Make PsppireDict not own its "struct dictionary".
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 7 Jul 2012 20:00:19 +0000 (13:00 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Mon, 9 Jul 2012 05:15:13 +0000 (22:15 -0700)
I see two places where PsppireDict are created.  The first is in
psppire-data-window.c.  In this case, the PsppireDataWindow is
borrowing a dictionary owned by a "struct dataset" for use in its
PsppireDict.  When it destroys the PsppireDict, therefore, the
dictionary must not be destroyed because the dataset still owns it.
However, this is not what actually happens, and doing the
following:

1. Start psppire
2. File | Open and load x.sav (dataset1)
3. File | New | Data (a new data window will appear: dataset2)
4. Using the window manager close the window for dataset1
5. In dataset2:  File | Open and load x.sav

or similar will cause a use-after-free error.

The second use is in text-data-import-dialog.c.  This code does own
the struct dictionary, but it can simply free it itself at the same
time as the PsppireDict.

There is still some underlying issue with the above scenario,
because it still reports a GtkCritical, but valgrind no longer
reports a use-after-free error.

Reported by John Darrington.


No differences found