gui: Avoid referencing freed data upon closing data window. 20130926030516/pspp 20130927030516/pspp
authorBen Pfaff <blp@cs.stanford.edu>
Thu, 26 Sep 2013 04:23:41 +0000 (21:23 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Thu, 26 Sep 2013 04:27:22 +0000 (21:27 -0700)
Without this commit, the following procedure always yielded Glib/GTK+
warnings or criticals for me:

1. Invoke PSPPIRE with a .sav file specified on the command line.
2. Choose Utilities|Variables...
3. Select a variable in the dialog box, then click on Cancel.
3. Close the output window using the window manager.
4. Close the data window using the window manager.

This commit fixes the problem.

src/ui/gui/psppire-data-store.c
src/ui/gui/psppire-data-window.c

index 732398511907686a8aa900dbe29e329bc1d6aea7..ea42339b35dd1d4f06f9ed4f7daf1d0f1c1a0170 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2006, 2008, 2009, 2010, 2011, 2012  Free Software Foundation
+   Copyright (C) 2006, 2008, 2009, 2010, 2011, 2012, 2013  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
@@ -390,6 +390,7 @@ psppire_data_store_dispose (GObject *object)
   if (ds->dispose_has_run)
     return;
 
+  psppire_data_store_set_dictionary (ds, NULL);
 
   /* must chain up */
   (* parent_class->dispose) (object);
index d9488b354990c6b4135a7db9cbe7d75a0de9402a..bb6c1ac892936f2bfac1049bb8b426359a45257f 100644 (file)
@@ -1095,6 +1095,15 @@ psppire_data_window_dispose (GObject *object)
 
   if (dw->dict)
     {
+      g_signal_handlers_disconnect_by_func (dw->dict,
+                                            G_CALLBACK (enable_save), dw);
+      g_signal_handlers_disconnect_by_func (dw->dict,
+                                            G_CALLBACK (on_weight_change), dw);
+      g_signal_handlers_disconnect_by_func (dw->dict,
+                                            G_CALLBACK (on_filter_change), dw);
+      g_signal_handlers_disconnect_by_func (dw->dict,
+                                            G_CALLBACK (on_split_change), dw);
+
       g_object_unref (dw->dict);
       dw->dict = NULL;
     }