aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell-view.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-09-10 02:24:15 +0800
committerDan Winship <danw@src.gnome.org>2001-09-10 02:24:15 +0800
commitafdc8acc65f24b38879ec991b2e335a069633a4a (patch)
tree12bb5657372f9b57f837c86ed26a5ce655b4eb64 /shell/e-shell-view.c
parent335bd912c0c00447801e0fa8baa8da16e9cef38a (diff)
downloadgsoc2013-evolution-afdc8acc65f24b38879ec991b2e335a069633a4a.tar
gsoc2013-evolution-afdc8acc65f24b38879ec991b2e335a069633a4a.tar.gz
gsoc2013-evolution-afdc8acc65f24b38879ec991b2e335a069633a4a.tar.bz2
gsoc2013-evolution-afdc8acc65f24b38879ec991b2e335a069633a4a.tar.lz
gsoc2013-evolution-afdc8acc65f24b38879ec991b2e335a069633a4a.tar.xz
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
Diffstat (limited to 'shell/e-shell-view.c')
-rw-r--r--shell/e-shell-view.c30
1 files changed, 18 insertions, 12 deletions
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 *)&copy_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));