From 17a85e8669435d6ad7d1fafe507288fee88e8122 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Fri, 24 Aug 2001 21:38:15 +0000 Subject: Ooops. Save the pointer to the control for use after the view struct is * e-shell-view.c (e_shell_view_remove_control_for_uri): Ooops. Save the pointer to the control for use after the view struct is freed. svn path=/trunk/; revision=12458 --- shell/ChangeLog | 6 ++++++ shell/e-shell-view.c | 17 +++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/shell/ChangeLog b/shell/ChangeLog index c1df4d31b3..ea482e762e 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,9 @@ +2001-08-24 Ettore Perazzoli + + * e-shell-view.c (e_shell_view_remove_control_for_uri): Ooops. + Save the pointer to the control for use after the view struct is + freed. + 2001-08-24 Ettore Perazzoli * e-shell-view.c: New struct `View'. Replace `uri_to_control' in diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index 3654e31fe4..5f89f6a9a3 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -1996,6 +1996,7 @@ e_shell_view_remove_control_for_uri (EShellView *shell_view, EShellViewPrivate *priv; View *view; GtkWidget *socket; + GtkWidget *control; int page_num; g_return_val_if_fail (shell_view != NULL, FALSE); @@ -2005,25 +2006,25 @@ e_shell_view_remove_control_for_uri (EShellView *shell_view, /* Get the control, remove it from our hash of controls */ view = g_hash_table_lookup (priv->uri_to_view, uri); - if (view != NULL) { - view_destroy (view); - g_hash_table_remove (priv->uri_to_view, uri); - } else { + if (view == NULL) return FALSE; - } + + control = view->control; + view_destroy (view); + g_hash_table_remove (priv->uri_to_view, uri); /* Get the socket, remove it from our list of sockets */ - socket = find_socket (GTK_CONTAINER (view->control)); + socket = find_socket (GTK_CONTAINER (control)); priv->sockets = g_list_remove (priv->sockets, socket); /* Remove the notebook page */ - page_num = gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook), view->control); + page_num = gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook), control); gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook), page_num); /* Destroy things, socket first because otherwise shell will think the control crashed */ gtk_widget_destroy (socket); - gtk_widget_destroy (view->control); + gtk_widget_destroy (control); return TRUE; } -- cgit v1.2.3