From 0e595276e5b32beae2a10ad3deb47a802866326f Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Tue, 5 Nov 2002 18:18:42 +0000 Subject: Split finalize/dispose. Likewise. Likewise. Likewise. Likewise. Likewise. * e-activity-handler.c: Split finalize/dispose. * e-corba-shortcuts.c: Likewise. * e-corba-storage-registry.c: Likewise. * e-shell-about-box.c: Likewise. * e-shell.c: Likewise. * e-splash.c: Likewise. * evolution-config-control.c: Likewise. * evolution-session.c: Likewise. * evolution-shell-component.c: Likewise. * evolution-shell-view.c: Likewise. * evolution-storage-set-view.c: Likewise. * evolution-storage.c: Likewise. * evolution-wizard.c: Likewise. svn path=/trunk/; revision=18556 --- shell/ChangeLog | 16 ++++++++++ shell/e-activity-handler.c | 19 ++++++++++-- shell/e-corba-shortcuts.c | 20 ++++++++++-- shell/e-corba-storage-registry.c | 20 ++++++++++-- shell/e-shell-about-box.c | 27 ++++++++++++++--- shell/e-shell.c | 62 ++++++++++++++++++++++++++++---------- shell/e-splash.c | 29 ++++++++++++++---- shell/evolution-config-control.c | 27 ++++++++++++++--- shell/evolution-session.c | 9 ++++++ shell/evolution-shell-component.c | 31 +++++++++++++------ shell/evolution-shell-view.c | 10 ++++++ shell/evolution-storage-set-view.c | 9 ++++++ shell/evolution-storage.c | 35 +++++++++++++++------ shell/evolution-wizard.c | 9 ++++++ 14 files changed, 265 insertions(+), 58 deletions(-) diff --git a/shell/ChangeLog b/shell/ChangeLog index d586a1a43a..09c9b4b283 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,19 @@ +2002-11-05 Ettore Perazzoli + + * e-activity-handler.c: Split finalize/dispose. + * e-corba-shortcuts.c: Likewise. + * e-corba-storage-registry.c: Likewise. + * e-shell-about-box.c: Likewise. + * e-shell.c: Likewise. + * e-splash.c: Likewise. + * evolution-config-control.c: Likewise. + * evolution-session.c: Likewise. + * evolution-shell-component.c: Likewise. + * evolution-shell-view.c: Likewise. + * evolution-storage-set-view.c: Likewise. + * evolution-storage.c: Likewise. + * evolution-wizard.c: Likewise. + 2002-11-05 Ettore Perazzoli * All: g_object_unref instead of bonobo_object_unref for the diff --git a/shell/e-activity-handler.c b/shell/e-activity-handler.c index e0002af2df..aab5216e69 100644 --- a/shell/e-activity-handler.c +++ b/shell/e-activity-handler.c @@ -327,7 +327,7 @@ task_bar_destroy_callback (GtkObject *task_bar_object, /* GObject methods. */ static void -impl_finalize (GObject *object) +impl_dispose (GObject *object) { EActivityHandler *handler; EActivityHandlerPrivate *priv; @@ -343,8 +343,22 @@ impl_finalize (GObject *object) activity_info_free (info); } + g_list_free (priv->activity_infos); + priv->activity_infos = NULL; + + (* G_OBJECT_CLASS (parent_class)->dispose) (object); +} + +static void +impl_finalize (GObject *object) +{ + EActivityHandler *handler; + EActivityHandlerPrivate *priv; + + handler = E_ACTIVITY_HANDLER (object); + priv = handler->priv; + g_free (priv); - handler->priv = NULL; (* G_OBJECT_CLASS (parent_class)->finalize) (object); } @@ -516,6 +530,7 @@ class_init (GObjectClass *object_class) parent_class = gtk_type_class (PARENT_TYPE); + object_class->dispose = impl_dispose; object_class->finalize = impl_finalize; handler_class = E_ACTIVITY_HANDLER_CLASS (object_class); diff --git a/shell/e-corba-shortcuts.c b/shell/e-corba-shortcuts.c index 6412d9e69d..8ebeeac02a 100644 --- a/shell/e-corba-shortcuts.c +++ b/shell/e-corba-shortcuts.c @@ -87,7 +87,7 @@ shortcut_list_to_corba (const GSList *shortcut_list, /* GObject methods. */ static void -impl_finalize (GObject *object) +impl_dispose (GObject *object) { ECorbaShortcuts *corba_shortcuts; ECorbaShortcutsPrivate *priv; @@ -95,9 +95,22 @@ impl_finalize (GObject *object) corba_shortcuts = E_CORBA_SHORTCUTS (object); priv = corba_shortcuts->priv; - g_object_unref (priv->shortcuts); + if (priv->shortcuts != NULL) { + g_object_unref (priv->shortcuts); + priv->shortcuts = NULL; + } + + (* G_OBJECT_CLASS (parent_class)->dispose) (object); +} + +static void +impl_finalize (GObject *object) +{ + ECorbaShortcuts *corba_shortcuts; + + corba_shortcuts = E_CORBA_SHORTCUTS (object); - g_free (priv); + g_free (corba_shortcuts->priv); (* G_OBJECT_CLASS (parent_class)->finalize) (object); } @@ -286,6 +299,7 @@ class_init (GObjectClass *object_class) parent_class = gtk_type_class (PARENT_TYPE); + object_class->dispose = impl_dispose; object_class->finalize = impl_finalize; corba_shortcuts_class = E_CORBA_SHORTCUTS_CLASS (object_class); diff --git a/shell/e-corba-storage-registry.c b/shell/e-corba-storage-registry.c index b7f69ef6fd..07db240d70 100644 --- a/shell/e-corba-storage-registry.c +++ b/shell/e-corba-storage-registry.c @@ -390,7 +390,7 @@ impl_StorageRegistry_getFolderByUri (PortableServer_Servant servant, /* GObject methods. */ static void -impl_finalize (GObject *object) +impl_dispose (GObject *object) { ECorbaStorageRegistry *corba_storage_registry; ECorbaStorageRegistryPrivate *priv; @@ -398,8 +398,23 @@ impl_finalize (GObject *object) corba_storage_registry = E_CORBA_STORAGE_REGISTRY (object); priv = corba_storage_registry->priv; - if (priv->storage_set != NULL) + if (priv->storage_set != NULL) { g_object_unref (priv->storage_set); + priv->storage_set = NULL; + } + + (* G_OBJECT_CLASS (parent_class)->dispose) (object); +} + +static void +impl_finalize (GObject *object) +{ + ECorbaStorageRegistry *corba_storage_registry; + ECorbaStorageRegistryPrivate *priv; + + corba_storage_registry = E_CORBA_STORAGE_REGISTRY (object); + priv = corba_storage_registry->priv; + g_free (priv); (* G_OBJECT_CLASS (parent_class)->finalize) (object); @@ -415,6 +430,7 @@ class_init (ECorbaStorageRegistryClass *klass) POA_GNOME_Evolution_StorageRegistry__epv *epv; object_class = G_OBJECT_CLASS (klass); + object_class->dispose = impl_dispose; object_class->finalize = impl_finalize; epv = & klass->epv; diff --git a/shell/e-shell-about-box.c b/shell/e-shell-about-box.c index a71fb553aa..65761da8aa 100644 --- a/shell/e-shell-about-box.c +++ b/shell/e-shell-about-box.c @@ -209,7 +209,7 @@ timeout_callback (void *data) /* GObject methods. */ static void -impl_finalize (GObject *object) +impl_dispose (GObject *object) { EShellAboutBox *about_box; EShellAboutBoxPrivate *priv; @@ -217,14 +217,32 @@ impl_finalize (GObject *object) about_box = E_SHELL_ABOUT_BOX (object); priv = about_box->priv; - if (priv->pixmap != NULL) + if (priv->pixmap != NULL) { gdk_pixmap_unref (priv->pixmap); + priv->pixmap = NULL; + } - if (priv->text_background_pixmap != NULL) + if (priv->text_background_pixmap != NULL) { gdk_pixmap_unref (priv->text_background_pixmap); + priv->text_background_pixmap = NULL; + } - if (priv->clipped_gc != NULL) + if (priv->clipped_gc != NULL) { gdk_gc_unref (priv->clipped_gc); + priv->clipped_gc = NULL; + } + + (* G_OBJECT_CLASS (parent_class)->dispose) (object); +} + +static void +impl_finalize (GObject *object) +{ + EShellAboutBox *about_box; + EShellAboutBoxPrivate *priv; + + about_box = E_SHELL_ABOUT_BOX (object); + priv = about_box->priv; if (priv->timeout_id != -1) g_source_remove (priv->timeout_id); @@ -347,6 +365,7 @@ class_init (GObjectClass *object_class) parent_class = gtk_type_class (PARENT_TYPE); + object_class->dispose = impl_dispose; object_class->finalize = impl_finalize; widget_class = GTK_WIDGET_CLASS (object_class); diff --git a/shell/e-shell.c b/shell/e-shell.c index bf55bf0da7..4b18b739d3 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -1026,7 +1026,7 @@ create_view (EShell *shell, /* GObject methods. */ static void -impl_finalize (GObject *object) +impl_dispose (GObject *object) { EShell *shell; EShellPrivate *priv; @@ -1037,36 +1037,45 @@ impl_finalize (GObject *object) priv->is_initialized = FALSE; - if (priv->iid != NULL) - bonobo_activation_active_server_unregister (priv->iid, bonobo_object_corba_objref (BONOBO_OBJECT (shell))); - - g_free (priv->local_directory); - if (priv->storage_set != NULL) { g_object_unref (priv->storage_set); priv->storage_set = NULL; } - if (priv->local_storage != NULL) + if (priv->local_storage != NULL) { g_object_unref (priv->local_storage); + priv->local_storage = NULL; + } - if (priv->summary_storage != NULL) + if (priv->summary_storage != NULL) { g_object_unref (priv->summary_storage); + priv->summary_storage = NULL; + } - if (priv->shortcuts != NULL) + if (priv->shortcuts != NULL) { g_object_unref (priv->shortcuts); + priv->shortcuts = NULL; + } - if (priv->folder_type_registry != NULL) + if (priv->folder_type_registry != NULL) { g_object_unref (priv->folder_type_registry); + priv->folder_type_registry = NULL; + } - if (priv->uri_schema_registry != NULL) + if (priv->uri_schema_registry != NULL) { g_object_unref (priv->uri_schema_registry); + priv->uri_schema_registry = NULL; + } - if (priv->component_registry != NULL) + if (priv->component_registry != NULL) { g_object_unref (priv->component_registry); + priv->component_registry = NULL; + } - if (priv->user_creatable_items_handler != NULL) + if (priv->user_creatable_items_handler != NULL) { g_object_unref (priv->user_creatable_items_handler); + priv->user_creatable_items_handler = NULL; + } for (p = priv->views; p != NULL; p = p->next) { EShellView *view; @@ -1084,6 +1093,7 @@ impl_finalize (GObject *object) } g_list_free (priv->views); + priv->views = NULL; /* No unreffing for these as they are aggregate. */ /* bonobo_object_unref (BONOBO_OBJECT (priv->corba_storage_registry)); */ @@ -1091,10 +1101,10 @@ impl_finalize (GObject *object) /* bonobo_object_unref (BONOBO_OBJECT (priv->corba_shortcuts)); */ /* FIXME. Maybe we should do something special here. */ - if (priv->offline_handler != NULL) + if (priv->offline_handler != NULL) { g_object_unref (priv->offline_handler); - - e_free_string_list (priv->crash_type_names); + priv->offline_handler = NULL; + } if (priv->settings_dialog != NULL) { gtk_widget_destroy (priv->settings_dialog); @@ -1106,6 +1116,25 @@ impl_finalize (GObject *object) priv->config_listener = NULL; } + (* G_OBJECT_CLASS (parent_class)->dispose) (object); +} + +static void +impl_finalize (GObject *object) +{ + EShell *shell; + EShellPrivate *priv; + + shell = E_SHELL (object); + priv = shell->priv; + + if (priv->iid != NULL) + bonobo_activation_active_server_unregister (priv->iid, bonobo_object_corba_objref (BONOBO_OBJECT (shell))); + + g_free (priv->local_directory); + + e_free_string_list (priv->crash_type_names); + g_free (priv); (* G_OBJECT_CLASS (parent_class)->finalize) (object); @@ -1123,6 +1152,7 @@ class_init (EShellClass *klass) parent_class = gtk_type_class (PARENT_TYPE); object_class = G_OBJECT_CLASS (klass); + object_class->dispose = impl_dispose; object_class->finalize = impl_finalize; signals[NO_VIEWS_LEFT] = diff --git a/shell/e-splash.c b/shell/e-splash.c index c2112eb3af..f56cf7c4e8 100644 --- a/shell/e-splash.c +++ b/shell/e-splash.c @@ -210,17 +210,36 @@ schedule_relayout (ESplash *splash) /* GObject methods. */ static void -impl_finalize (GObject *object) +impl_dispose (GObject *object) { ESplash *splash; ESplashPrivate *priv; - GList *p; splash = E_SPLASH (object); priv = splash->priv; - if (priv->splash_image_pixbuf != NULL) + if (priv->splash_image_pixbuf != NULL) { gdk_pixbuf_unref (priv->splash_image_pixbuf); + priv->splash_image_pixbuf = NULL; + } + + if (priv->layout_idle_id != 0) { + gtk_idle_remove (priv->layout_idle_id); + priv->layout_idle_id = 0; + } + + (* G_OBJECT_CLASS (parent_class)->dispose) (object); +} + +static void +impl_finalize (GObject *object) +{ + ESplash *splash; + ESplashPrivate *priv; + GList *p; + + splash = E_SPLASH (object); + priv = splash->priv; for (p = priv->icons; p != NULL; p = p->next) { Icon *icon; @@ -231,9 +250,6 @@ impl_finalize (GObject *object) g_list_free (priv->icons); - if (priv->layout_idle_id != 0) - gtk_idle_remove (priv->layout_idle_id); - g_free (priv); (* G_OBJECT_CLASS (parent_class)->finalize) (object); @@ -246,6 +262,7 @@ class_init (ESplashClass *klass) GObjectClass *object_class; object_class = G_OBJECT_CLASS (klass); + object_class->dispose = impl_dispose; object_class->finalize = impl_finalize; parent_class = gtk_type_class (gtk_window_get_type ()); diff --git a/shell/evolution-config-control.c b/shell/evolution-config-control.c index a803880772..2036cca249 100644 --- a/shell/evolution-config-control.c +++ b/shell/evolution-config-control.c @@ -53,7 +53,7 @@ static int signals[LAST_SIGNAL] = { 0 }; /* GObject methods. */ static void -impl_finalize (GObject *object) +impl_dispose (GObject *object) { EvolutionConfigControl *config_control; EvolutionConfigControlPrivate *priv; @@ -61,14 +61,30 @@ impl_finalize (GObject *object) config_control = EVOLUTION_CONFIG_CONTROL (object); priv = config_control->priv; - if (priv != NULL) { + if (priv->control != NULL) { bonobo_object_unref (BONOBO_OBJECT (priv->control)); - bonobo_object_unref (BONOBO_OBJECT (priv->event_source)); + priv->control = NULL; + } - g_free (priv); - config_control->priv = NULL; + if (priv->event_source != NULL) { + bonobo_object_unref (BONOBO_OBJECT (priv->event_source)); + priv->event_source = NULL; } + (* G_OBJECT_CLASS (parent_class)->dispose) (object); +} + +static void +impl_finalize (GObject *object) +{ + EvolutionConfigControl *config_control; + EvolutionConfigControlPrivate *priv; + + config_control = EVOLUTION_CONFIG_CONTROL (object); + priv = config_control->priv; + + g_free (priv); + (* G_OBJECT_CLASS (parent_class)->finalize) (object); } @@ -128,6 +144,7 @@ class_init (EvolutionConfigControlClass *class) GObjectClass *object_class; object_class = G_OBJECT_CLASS (class); + object_class->dispose = impl_dispose; object_class->finalize = impl_finalize; epv = &class->epv; diff --git a/shell/evolution-session.c b/shell/evolution-session.c index c74e071a00..d7c25ea99a 100644 --- a/shell/evolution-session.c +++ b/shell/evolution-session.c @@ -50,6 +50,14 @@ static int signals[LAST_SIGNAL]; /* GObject methods. */ +static void +impl_dispose (GObject *object) +{ + /* Nothing to do here. */ + + (* G_OBJECT_CLASS (parent_class)->dispose) (object); +} + static void impl_finalize (GObject *object) { @@ -110,6 +118,7 @@ class_init (EvolutionSessionClass *klass) object_class = G_OBJECT_CLASS (klass); parent_class = gtk_type_class (PARENT_TYPE); + object_class->dispose = impl_dispose; object_class->finalize = impl_finalize; signals[LOAD_CONFIGURATION] diff --git a/shell/evolution-shell-component.c b/shell/evolution-shell-component.c index 8a757b0219..d6392a08bb 100644 --- a/shell/evolution-shell-component.c +++ b/shell/evolution-shell-component.c @@ -755,13 +755,10 @@ impl_requestQuit (PortableServer_Servant servant, /* GObject methods. */ static void -impl_finalize (GObject *object) +impl_dispose (GObject *object) { EvolutionShellComponent *shell_component; EvolutionShellComponentPrivate *priv; - CORBA_Environment ev; - GSList *sp; - GList *p; shell_component = EVOLUTION_SHELL_COMPONENT (object); @@ -772,14 +769,30 @@ impl_finalize (GObject *object) priv->ping_timeout_id = -1; } - CORBA_exception_init (&ev); - if (priv->owner_client != NULL) { g_object_unref (priv->owner_client); priv->owner_client = NULL; } - CORBA_exception_free (&ev); + if (priv->uic != NULL) { + bonobo_object_unref (BONOBO_OBJECT (priv->uic)); + priv->uic = NULL; + } + + (* G_OBJECT_CLASS (parent_class)->dispose) (object); +} + +static void +impl_finalize (GObject *object) +{ + EvolutionShellComponent *shell_component; + EvolutionShellComponentPrivate *priv; + GSList *sp; + GList *p; + + shell_component = EVOLUTION_SHELL_COMPONENT (object); + + priv = shell_component->priv; for (p = priv->folder_types; p != NULL; p = p->next) { EvolutionShellComponentFolderType *folder_type; @@ -801,9 +814,6 @@ impl_finalize (GObject *object) user_creatable_item_type_free ((UserCreatableItemType *) sp->data); g_slist_free (priv->user_creatable_item_types); - if (priv->uic != NULL) - bonobo_object_unref (BONOBO_OBJECT (priv->uic)); - g_free (priv); (* G_OBJECT_CLASS (parent_class)->finalize) (object); @@ -857,6 +867,7 @@ class_init (EvolutionShellComponentClass *klass) POA_GNOME_Evolution_ShellComponent__epv *epv = &klass->epv; object_class = G_OBJECT_CLASS (klass); + object_class->dispose = impl_dispose; object_class->finalize = impl_finalize; signals[OWNER_SET] diff --git a/shell/evolution-shell-view.c b/shell/evolution-shell-view.c index 943d981ee1..fc77785dd3 100644 --- a/shell/evolution-shell-view.c +++ b/shell/evolution-shell-view.c @@ -119,6 +119,15 @@ impl_ShellView_show_settings (PortableServer_Servant servant, /* GObject methods. */ + +static void +impl_dispose (GObject *object) +{ + /* Nothing to do here. */ + + (* G_OBJECT_CLASS (parent_class)->dispose) (object); +} + static void impl_finalize (GObject *object) { @@ -141,6 +150,7 @@ class_init (EvolutionShellViewClass *klass) GObjectClass *object_class; object_class = G_OBJECT_CLASS (klass); + object_class->dispose = impl_dispose; object_class->finalize = impl_finalize; epv = &klass->epv; diff --git a/shell/evolution-storage-set-view.c b/shell/evolution-storage-set-view.c index 83a5a9063a..0674356162 100644 --- a/shell/evolution-storage-set-view.c +++ b/shell/evolution-storage-set-view.c @@ -365,6 +365,14 @@ impl_StorageSetView__get_checkedFolders (PortableServer_Servant servant, /* GObject methods. */ +static void +impl_dispose (GObject *object) +{ + /* (Nothing to do here.) */ + + (* G_OBJECT_CLASS (parent_class)->dispose) (object); +} + static void impl_finalize (GObject *object) { @@ -400,6 +408,7 @@ class_init (EvolutionStorageSetViewClass *klass) GObjectClass *object_class; object_class = G_OBJECT_CLASS (klass); + object_class->dispose = impl_dispose; object_class->finalize = impl_finalize; epv = & (klass->epv); diff --git a/shell/evolution-storage.c b/shell/evolution-storage.c index 19cb957061..7bbe0e62b8 100644 --- a/shell/evolution-storage.c +++ b/shell/evolution-storage.c @@ -608,25 +608,16 @@ free_mapping (gpointer key, gpointer value, gpointer user_data) } static void -impl_finalize (GObject *object) +impl_dispose (GObject *object) { EvolutionStorage *storage; EvolutionStoragePrivate *priv; CORBA_Environment ev; GList *p; - GSList *sp; storage = EVOLUTION_STORAGE (object); priv = storage->priv; - g_free (priv->name); - if (priv->folder_tree != NULL) - e_folder_tree_destroy (priv->folder_tree); - if (priv->uri_to_path != NULL) { - g_hash_table_foreach (priv->uri_to_path, free_mapping, NULL); - g_hash_table_destroy (priv->uri_to_path); - } - CORBA_exception_init (&ev); for (p = priv->corba_storage_listeners; p != NULL; p = p->next) { @@ -641,9 +632,32 @@ impl_finalize (GObject *object) } g_list_free (priv->corba_storage_listeners); + priv->corba_storage_listeners = NULL; CORBA_exception_free (&ev); + (* G_OBJECT_CLASS (parent_class)->dispose) (object); +} + +static void +impl_finalize (GObject *object) +{ + EvolutionStorage *storage; + EvolutionStoragePrivate *priv; + GList *p; + GSList *sp; + + storage = EVOLUTION_STORAGE (object); + priv = storage->priv; + + g_free (priv->name); + if (priv->folder_tree != NULL) + e_folder_tree_destroy (priv->folder_tree); + if (priv->uri_to_path != NULL) { + g_hash_table_foreach (priv->uri_to_path, free_mapping, NULL); + g_hash_table_destroy (priv->uri_to_path); + } + for (sp = priv->folder_property_items; p != NULL; p = p->next) { FolderPropertyItem *item; @@ -670,6 +684,7 @@ class_init (EvolutionStorageClass *klass) GObjectClass *object_class; object_class = G_OBJECT_CLASS (klass); + object_class->dispose = impl_dispose; object_class->finalize = impl_finalize; epv = & klass->epv; diff --git a/shell/evolution-wizard.c b/shell/evolution-wizard.c index 2582b8d6dd..92b3ba163a 100644 --- a/shell/evolution-wizard.c +++ b/shell/evolution-wizard.c @@ -154,6 +154,14 @@ impl_GNOME_Evolution_Wizard_notifyAction (PortableServer_Servant servant, } +static void +impl_dispose (GObject *object) +{ + /* (Nothing to do here.) */ + + (* G_OBJECT_CLASS (parent_class)->dispose) (object); +} + static void impl_finalize (GObject *object) { @@ -177,6 +185,7 @@ evolution_wizard_class_init (EvolutionWizardClass *klass) POA_GNOME_Evolution_Wizard__epv *epv = &klass->epv; object_class = G_OBJECT_CLASS (klass); + object_class->dispose = impl_dispose; object_class->finalize = impl_finalize; signals[NEXT] = gtk_signal_new ("next", GTK_RUN_FIRST, -- cgit v1.2.3