From: Ben Pfaff Date: Thu, 26 Sep 2013 04:23:41 +0000 (-0700) Subject: gui: Avoid referencing freed data upon closing data window. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12f0fc452580c0414d045ea1d8d94542ec3c47c8;p=pspp gui: Avoid referencing freed data upon closing data window. 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. --- diff --git a/src/ui/gui/psppire-data-store.c b/src/ui/gui/psppire-data-store.c index 7323985119..ea42339b35 100644 --- a/src/ui/gui/psppire-data-store.c +++ b/src/ui/gui/psppire-data-store.c @@ -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); diff --git a/src/ui/gui/psppire-data-window.c b/src/ui/gui/psppire-data-window.c index d9488b3549..bb6c1ac892 100644 --- a/src/ui/gui/psppire-data-window.c +++ b/src/ui/gui/psppire-data-window.c @@ -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; }