diff options
author | Dan Winship <danw@src.gnome.org> | 2001-09-10 02:24:15 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2001-09-10 02:24:15 +0800 |
commit | afdc8acc65f24b38879ec991b2e335a069633a4a (patch) | |
tree | 12bb5657372f9b57f837c86ed26a5ce655b4eb64 | |
parent | 335bd912c0c00447801e0fa8baa8da16e9cef38a (diff) | |
download | gsoc2013-evolution-afdc8acc65f24b38879ec991b2e335a069633a4a.tar.gz gsoc2013-evolution-afdc8acc65f24b38879ec991b2e335a069633a4a.tar.zst gsoc2013-evolution-afdc8acc65f24b38879ec991b2e335a069633a4a.zip |
Purify run. All small leaks.
* e-shell-folder-commands.c
(folder_selection_dialog_folder_selected_callback): Free the
folder_command_data when destroying the dialog.
* e-local-storage.c (remove_folder): Free physical_uri if we
allocated it.
* e-shortcuts-view.c (pop_up_right_click_menu_for_group): Unref
the popup menu, don't destroy it.
(destroy_group_cb): Free the question string.
(rename_group_cb): Free the new_name.
* e-shell-importer.c (create_plugin_menu): Free the list of
importers.
(get_iid_for_filetype): Likewise.
(import_druid_finish): #ifdef out some g_strdups that are only
used by other #ifdef'ed-out code.
* e-shell-view.c: Make sure the keys in the uri_to_view hash get
freed.
* e-shell-folder-title-bar.c (set_title_bar_label_style): Unref
the style after setting it on the widget.
* e-shell-offline-handler.c (impl_destroy): free priv.
* e-storage-set-view.c (tree_drag_data_received): Make sure
target_type always gets freed.
* e-shell-folder-creation-dialog.c (add_folder_types): Don't leak
the type names.
svn path=/trunk/; revision=12715
-rw-r--r-- | shell/ChangeLog | 36 | ||||
-rw-r--r-- | shell/e-local-storage.c | 5 | ||||
-rw-r--r-- | shell/e-shell-folder-commands.c | 1 | ||||
-rw-r--r-- | shell/e-shell-folder-creation-dialog.c | 4 | ||||
-rw-r--r-- | shell/e-shell-folder-title-bar.c | 1 | ||||
-rw-r--r-- | shell/e-shell-importer.c | 4 | ||||
-rw-r--r-- | shell/e-shell-offline-handler.c | 2 | ||||
-rw-r--r-- | shell/e-shell-view.c | 30 | ||||
-rw-r--r-- | shell/e-shortcuts-view.c | 6 | ||||
-rw-r--r-- | shell/e-storage-set-view.c | 8 |
10 files changed, 75 insertions, 22 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 6f25ed4027..72fdc403b6 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,39 @@ +2001-09-09 Dan Winship <danw@ximian.com> + + Purify run. All small leaks. + + * e-shell-folder-commands.c + (folder_selection_dialog_folder_selected_callback): Free the + folder_command_data when destroying the dialog. + + * e-local-storage.c (remove_folder): Free physical_uri if we + allocated it. + + * e-shortcuts-view.c (pop_up_right_click_menu_for_group): Unref + the popup menu, don't destroy it. + (destroy_group_cb): Free the question string. + (rename_group_cb): Free the new_name. + + * e-shell-importer.c (create_plugin_menu): Free the list of + importers. + (get_iid_for_filetype): Likewise. + (import_druid_finish): #ifdef out some g_strdups that are only + used by other #ifdef'ed-out code. + + * e-shell-view.c: Make sure the keys in the uri_to_view hash get + freed. + + * e-shell-folder-title-bar.c (set_title_bar_label_style): Unref + the style after setting it on the widget. + + * e-shell-offline-handler.c (impl_destroy): free priv. + + * e-storage-set-view.c (tree_drag_data_received): Make sure + target_type always gets freed. + + * e-shell-folder-creation-dialog.c (add_folder_types): Don't leak + the type names. + 2001-09-07 Iain Holmes <iain@ximian.com> * e-shell-startup-wizard.c (prepare_importer_page): New design. diff --git a/shell/e-local-storage.c b/shell/e-local-storage.c index c06edcca9a..f90f29ea59 100644 --- a/shell/e-local-storage.c +++ b/shell/e-local-storage.c @@ -534,7 +534,7 @@ remove_folder (ELocalStorage *local_storage, AsyncRemoveFolderCallbackData *callback_data; EvolutionShellComponentClient *component_client; EFolder *folder; - char *physical_path; + char *physical_path, *physical_uri_mem = NULL; GList *subfolder_paths; GList *p; @@ -554,7 +554,7 @@ remove_folder (ELocalStorage *local_storage, physical_path = e_path_to_physical (priv->base_path, path); if (!physical_uri) - physical_uri = g_strconcat ("file://", physical_path, NULL); + physical_uri = physical_uri_mem = g_strconcat ("file://", physical_path, NULL); /* Recursively remove the subfolders */ subfolder_paths = e_storage_get_subfolder_paths (storage, path); @@ -574,6 +574,7 @@ remove_folder (ELocalStorage *local_storage, e_folder_get_type_string (folder), component_async_remove_folder_callback, callback_data); + g_free (physical_uri_mem); return EVOLUTION_SHELL_COMPONENT_OK; } diff --git a/shell/e-shell-folder-commands.c b/shell/e-shell-folder-commands.c index cd72ff8acd..b1cc047f85 100644 --- a/shell/e-shell-folder-commands.c +++ b/shell/e-shell-folder-commands.c @@ -206,6 +206,7 @@ folder_selection_dialog_folder_selected_callback (EShellFolderSelectionDialog *f folder_command_data); gtk_widget_destroy (GTK_WIDGET (folder_selection_dialog)); + folder_command_data_free (folder_command_data); } static void diff --git a/shell/e-shell-folder-creation-dialog.c b/shell/e-shell-folder-creation-dialog.c index cead2d2745..dfee004a1e 100644 --- a/shell/e-shell-folder-creation-dialog.c +++ b/shell/e-shell-folder-creation-dialog.c @@ -409,7 +409,7 @@ add_folder_types (GtkWidget *dialog, TypeWithDisplayName *new; new = g_new (TypeWithDisplayName, 1); - new->type = g_strdup ((const char *) p->data); + new->type = p->data; new->display_name = e_folder_type_registry_get_display_name_for_type (folder_type_registry, new->type); types_with_display_names = g_list_prepend (types_with_display_names, new); @@ -434,7 +434,7 @@ add_folder_types (GtkWidget *dialog, gtk_widget_show (menu_item); gtk_menu_append (GTK_MENU (menu), menu_item); - gtk_object_set_data (GTK_OBJECT (menu_item), "folder_type", (void *) type->type); + gtk_object_set_data_full (GTK_OBJECT (menu_item), "folder_type", g_strdup (type->type), g_free); if (strcmp (type->type, "mail") == 0) default_item = i; diff --git a/shell/e-shell-folder-title-bar.c b/shell/e-shell-folder-title-bar.c index 4c13a146a0..a3509546b5 100644 --- a/shell/e-shell-folder-title-bar.c +++ b/shell/e-shell-folder-title-bar.c @@ -187,6 +187,7 @@ set_title_bar_label_style (GtkWidget *widget) rc_style->fg[GTK_STATE_NORMAL].blue = 0xffff; gtk_widget_modify_style (widget, rc_style); + gtk_rc_style_unref (rc_style); } diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c index 0c82f91989..a22d44732b 100644 --- a/shell/e-shell-importer.c +++ b/shell/e-shell-importer.c @@ -312,6 +312,7 @@ get_iid_for_filetype (const char *filename) bonobo_object_release_unref (importer, &ev2); CORBA_exception_free (&ev2); } + CORBA_free (info_list); if (len == 1) { ret_iid = can_handle->data; @@ -530,6 +531,7 @@ create_plugin_menu (ImportData *data) g_strdup (info->iid), g_free); gtk_menu_append (GTK_MENU (menu), item); } + CORBA_free (info_list); return menu; } @@ -629,11 +631,13 @@ import_druid_finish (GnomeDruidPage *page, ImportData *data) { GtkWidget *folder; +#if 0 char *filename; char *iid; filename = g_strdup (gtk_entry_get_text (GTK_ENTRY (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (data->filepage->filename))))); iid = g_strdup (data->choosen_iid); +#endif folder = e_shell_folder_selection_dialog_new (data->shell, _("Select folder"), diff --git a/shell/e-shell-offline-handler.c b/shell/e-shell-offline-handler.c index 3369de0075..bf3c0120ee 100644 --- a/shell/e-shell-offline-handler.c +++ b/shell/e-shell-offline-handler.c @@ -667,6 +667,8 @@ impl_destroy (GtkObject *object) priv->dialog_gui = NULL; } + g_free (priv); + if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index 4161ba727a..932f45bc32 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -1002,6 +1002,8 @@ hash_forall_destroy_view (void *name, gtk_widget_destroy (view->control); view_destroy (view); + + g_free (name); } static void @@ -1687,14 +1689,10 @@ socket_destroy_cb (GtkWidget *socket_widget, gpointer data) uri = (const char *) gtk_object_get_data (GTK_OBJECT (socket_widget), "e_shell_view_folder_uri"); - /* Strdup here as the string will be freed when the socket is destroyed. */ - copy_of_uri = g_strdup (uri); - - view = g_hash_table_lookup (priv->uri_to_view, uri); - - if (view == NULL) { + if (!g_hash_table_lookup_extended (priv->uri_to_view, uri, + (gpointer *)©_of_uri, + (gpointer *)&view)) { g_warning ("What?! Destroyed socket for non-existing URI? -- %s", uri); - g_free (copy_of_uri); return; } @@ -1704,6 +1702,7 @@ socket_destroy_cb (GtkWidget *socket_widget, gpointer data) view_destroy (view); g_hash_table_remove (priv->uri_to_view, uri); + g_free (copy_of_uri); path = get_storage_set_path_from_uri (uri); folder = e_storage_set_get_folder (e_shell_get_storage_set (priv->shell), path); @@ -1736,7 +1735,7 @@ socket_destroy_cb (GtkWidget *socket_widget, gpointer data) e_shell_component_maybe_crashed (priv->shell, uri, folder_type, shell_view); - /* We were actively viewing the component that just crashed, so flip to the Inbox */ + /* We were actively viewing the component that just crashed, so flip to the default URI */ if (viewing_closed_uri) e_shell_view_display_uri (shell_view, E_SHELL_VIEW_DEFAULT_URI); @@ -1890,7 +1889,6 @@ show_existing_view (EShellView *shell_view, /* Out with the old. */ gtk_container_remove (GTK_CONTAINER (parent), view->control); view_destroy (view); - g_hash_table_remove (priv->uri_to_view, uri); /* In with the new. */ view = get_view_for_uri (shell_view, uri); @@ -1898,7 +1896,12 @@ show_existing_view (EShellView *shell_view, return FALSE; gtk_container_add (GTK_CONTAINER (parent), view->control); - g_hash_table_insert (priv->uri_to_view, g_strdup (uri), view); + + /* The old (destroyed) view is already in the hash table, + * and g_hash_table_insert will re-use its old (strdup'ed) + * key rather than the one we pass here. + */ + g_hash_table_insert (priv->uri_to_view, (char *)uri, view); /* Show. */ gtk_widget_show (view->control); @@ -2015,6 +2018,7 @@ e_shell_view_remove_control_for_uri (EShellView *shell_view, GtkWidget *control; int page_num; int destroy_connection_id; + char *old_key; g_return_val_if_fail (shell_view != NULL, FALSE); g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE); @@ -2022,8 +2026,9 @@ e_shell_view_remove_control_for_uri (EShellView *shell_view, priv = shell_view->priv; /* Get the control, remove it from our hash of controls */ - view = g_hash_table_lookup (priv->uri_to_view, uri); - if (view == NULL) { + if (!g_hash_table_lookup_extended (priv->uri_to_view, uri, + (gpointer *)&old_key, + (gpointer *)&view)) { g_message ("Trying to remove view for non-existing URI -- %s", uri); return FALSE; } @@ -2031,6 +2036,7 @@ e_shell_view_remove_control_for_uri (EShellView *shell_view, control = view->control; view_destroy (view); g_hash_table_remove (priv->uri_to_view, uri); + g_free (old_key); /* Get the socket, remove it from our list of sockets */ socket = find_socket (GTK_CONTAINER (control)); diff --git a/shell/e-shortcuts-view.c b/shell/e-shortcuts-view.c index 192d05ab56..24730a6268 100644 --- a/shell/e-shortcuts-view.c +++ b/shell/e-shortcuts-view.c @@ -181,6 +181,7 @@ destroy_group_cb (GtkWidget *widget, _("Remove"), _("Don't remove"), NULL); gnome_dialog_set_parent (GNOME_DIALOG (message_box), GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (shortcuts_view)))); + g_free (question); if (gnome_dialog_run_and_close (GNOME_DIALOG (message_box)) != 0) return; @@ -196,7 +197,7 @@ rename_group_cb (GtkWidget *widget, EShortcuts *shortcuts; EShortcutsView *shortcuts_view; const char *old_name; - const char *new_name; + char *new_name; int group; menu_data = (RightClickMenuData *) data; @@ -216,6 +217,7 @@ rename_group_cb (GtkWidget *widget, /* Remember the group and flip back to it */ group = e_group_bar_get_current_group_num (E_GROUP_BAR (E_SHORTCUT_BAR (shortcuts_view))); e_shortcuts_rename_group (shortcuts, menu_data->group_num, new_name); + g_free (new_name); e_group_bar_set_current_group_num (E_GROUP_BAR (E_SHORTCUT_BAR (shortcuts_view)), group, FALSE); } @@ -282,7 +284,7 @@ pop_up_right_click_menu_for_group (EShortcutsView *shortcuts_view, gnome_popup_menu_do_popup_modal (popup_menu, NULL, NULL, event, menu_data); g_free (menu_data); - gtk_widget_destroy (popup_menu); + gtk_widget_unref (popup_menu); } diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c index 29b719e396..6738c7007a 100644 --- a/shell/e-storage-set-view.c +++ b/shell/e-storage-set-view.c @@ -1147,16 +1147,17 @@ tree_drag_data_received (ETree *etree, storage_set_view = E_STORAGE_SET_VIEW (etree); priv = storage_set_view->priv; - target_type = gdk_atom_name (selection_data->target); - if (selection_data->data == NULL && selection_data->length == -1) return; + target_type = gdk_atom_name (selection_data->target); + if (strcmp (target_type, EVOLUTION_PATH_TARGET_TYPE) == 0) { const char *source_path; const char *destination_folder_path; char *destination_path; + g_free (target_type); source_path = (const char *) selection_data->data; /* (Basic sanity checks.) */ if (source_path == NULL || source_path[0] != G_DIR_SEPARATOR || source_path[1] == '\0') @@ -1239,11 +1240,10 @@ tree_drag_data_received (ETree *etree, } } + g_free (target_type); } gtk_drag_finish (context, handled, FALSE, time); - - g_free (target_type); } static gboolean |