From: John Darrington Date: Fri, 2 Jan 2009 07:47:34 +0000 (+0900) Subject: Make sure finalizers are called properly X-Git-Tag: v0.7.3~296^2~8^2~3 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d502474673494b002af0bc5c97c21837a1e54f89;p=pspp-builds.git Make sure finalizers are called properly --- diff --git a/src/ui/gui/psppire-data-window.c b/src/ui/gui/psppire-data-window.c index 90e749d3..0716804e 100644 --- a/src/ui/gui/psppire-data-window.c +++ b/src/ui/gui/psppire-data-window.c @@ -100,19 +100,15 @@ psppire_data_window_get_type (void) return psppire_data_window_type; } +static GObjectClass *parent_class ; static void psppire_data_window_finalize (GObject *object) { PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (object); - GObjectClass *class = G_OBJECT_GET_CLASS (object); - - GObjectClass *parent_class = g_type_class_peek_parent (class); - g_object_unref (de->xml); - if (G_OBJECT_CLASS (parent_class)->finalize) (*G_OBJECT_CLASS (parent_class)->finalize) (object); } @@ -121,6 +117,7 @@ psppire_data_window_finalize (GObject *object) static void psppire_data_window_class_init (PsppireDataWindowClass *class) { + parent_class = g_type_class_peek_parent (class); } diff --git a/src/ui/gui/psppire-output-window.c b/src/ui/gui/psppire-output-window.c index 5fc52e9b..abbcae71 100644 --- a/src/ui/gui/psppire-output-window.c +++ b/src/ui/gui/psppire-output-window.c @@ -75,24 +75,23 @@ psppire_output_window_get_type (void) return psppire_output_window_type; } +static GObjectClass *parent_class; static void psppire_output_window_finalize (GObject *object) { GObjectClass *class = G_OBJECT_GET_CLASS (object); - GObjectClass *parent_class = g_type_class_peek_parent (class); - if (G_OBJECT_CLASS (parent_class)->finalize) (*G_OBJECT_CLASS (parent_class)->finalize) (object); - } static void psppire_output_window_class_init (PsppireOutputWindowClass *class) { + parent_class = g_type_class_peek_parent (class); } diff --git a/src/ui/gui/psppire-syntax-window.c b/src/ui/gui/psppire-syntax-window.c index 37bfd35c..3fe6d1a6 100644 --- a/src/ui/gui/psppire-syntax-window.c +++ b/src/ui/gui/psppire-syntax-window.c @@ -70,13 +70,13 @@ psppire_syntax_window_get_type (void) return psppire_syntax_window_type; } +static GObjectClass *parent_class ; + static void psppire_syntax_window_finalize (GObject *object) { GObjectClass *class = G_OBJECT_GET_CLASS (object); - GObjectClass *parent_class = g_type_class_peek_parent (class); - if (G_OBJECT_CLASS (parent_class)->finalize) (*G_OBJECT_CLASS (parent_class)->finalize) (object); } @@ -93,6 +93,8 @@ psppire_syntax_window_base_init (PsppireSyntaxWindowClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); + parent_class = g_type_class_peek_parent (class); + object_class->finalize = psppire_syntax_window_finalize; }