diff options
author | 5 <NotZed@Ximian.com> | 2001-09-26 06:18:52 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2001-09-26 06:18:52 +0800 |
commit | ba5b1b6be7d3beed85c1f6b51d5808f9a7d72b5f (patch) | |
tree | 1cb7ee7b3057358d5540e7ebd08bc0382d7e3c8a /mail/folder-browser.c | |
parent | c76e6322cf850d3e7a909ae1353bdde8b2911cac (diff) | |
download | gsoc2013-evolution-ba5b1b6be7d3beed85c1f6b51d5808f9a7d72b5f.tar.gz gsoc2013-evolution-ba5b1b6be7d3beed85c1f6b51d5808f9a7d72b5f.tar.zst gsoc2013-evolution-ba5b1b6be7d3beed85c1f6b51d5808f9a7d72b5f.zip |
Deal with destroy vs finalise semantics. Only destroy widgets here.
2001-09-25 <NotZed@Ximian.com>
* folder-browser.c (folder_browser_destroy): Deal with destroy vs
finalise semantics. Only destroy widgets here.
(folder_browser_finalise): object finalise function, actually
unref/free all other objects here.
(folder_browser_class_init): Init the finalise hook.
(got_folder): Check if message_list == NULL -> we've been
destroyed before the thread got a chance to finish loading the
folder.
(folder_browser_is_drafts): Dont use a g_return_if_fail to return
in what could be a valid state of the object.
(folder_browser_is_sent): Likewise.
(folder_browser_copy): Do nothing if message_list == NULL.
* main.c (main): call mail_msg_cleanup() before leaving threads.
* component-factory.c (owner_unset_cb): Wait for all outstanding
operations to finish before setting up to quit.
(idle_quit): Wait for all outstanding ops to finish before
cleanup.
(unref_standard_folders): NULL out the standard folder before
unreffing it.
* mail-mt.c (mail_msg_wait_all): New function to wait for all
outstanding thread operations.
(mail_msg_cleanup): Destroy the io channels before we're
finished. Also wait for all outstanding threads first. Made
public.
(mail_msg_init): Dont call mail_msg_cleanup atexit automatically.
svn path=/trunk/; revision=13129
Diffstat (limited to 'mail/folder-browser.c')
-rw-r--r-- | mail/folder-browser.c | 67 |
1 files changed, 51 insertions, 16 deletions
diff --git a/mail/folder-browser.c b/mail/folder-browser.c index f577d46e88..492a17b900 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -109,13 +109,13 @@ enum { static guint folder_browser_signals [LAST_SIGNAL] = {0, }; static void -folder_browser_destroy (GtkObject *object) +folder_browser_finalise (GtkObject *object) { FolderBrowser *folder_browser; CORBA_Environment ev; - - folder_browser = FOLDER_BROWSER (object); - + + folder_browser = FOLDER_BROWSER(object); + CORBA_exception_init (&ev); if (folder_browser->search_full) @@ -124,17 +124,22 @@ folder_browser_destroy (GtkObject *object) if (folder_browser->sensitize_timeout_id) g_source_remove (folder_browser->sensitize_timeout_id); - if (folder_browser->shell != CORBA_OBJECT_NIL) + if (folder_browser->shell != CORBA_OBJECT_NIL) { CORBA_Object_release (folder_browser->shell, &ev); + folder_browser->shell = CORBA_OBJECT_NIL; + } - if (folder_browser->shell_view != CORBA_OBJECT_NIL) + if (folder_browser->shell_view != CORBA_OBJECT_NIL) { CORBA_Object_release(folder_browser->shell_view, &ev); + folder_browser->shell_view = CORBA_OBJECT_NIL; + } if (folder_browser->uicomp) bonobo_object_unref (BONOBO_OBJECT (folder_browser->uicomp)); g_free (folder_browser->uri); - + folder_browser->uri = NULL; + if (folder_browser->folder) { camel_object_unhook_event(CAMEL_OBJECT(folder_browser->folder), "folder_changed", folder_changed, folder_browser); @@ -142,14 +147,9 @@ folder_browser_destroy (GtkObject *object) folder_changed, folder_browser); mail_sync_folder (folder_browser->folder, NULL, NULL); camel_object_unref (CAMEL_OBJECT (folder_browser->folder)); + folder_browser->folder = NULL; } - if (folder_browser->message_list) - gtk_widget_destroy (GTK_WIDGET (folder_browser->message_list)); - - if (folder_browser->mail_display) - gtk_widget_destroy (GTK_WIDGET (folder_browser->mail_display)); - CORBA_exception_free (&ev); if (folder_browser->view_collection) { @@ -163,9 +163,31 @@ folder_browser_destroy (GtkObject *object) } gtk_object_unref (GTK_OBJECT (folder_browser->invisible)); + folder_browser->invisible = NULL; + if (folder_browser->clipboard_selection) g_byte_array_free (folder_browser->clipboard_selection, TRUE); + + folder_browser_parent_class->finalize(object); +} + +static void +folder_browser_destroy (GtkObject *object) +{ + FolderBrowser *folder_browser; + + folder_browser = FOLDER_BROWSER (object); + + if (folder_browser->message_list) { + gtk_widget_destroy (GTK_WIDGET (folder_browser->message_list)); + folder_browser->message_list = NULL; + } + if (folder_browser->mail_display) { + gtk_widget_destroy (GTK_WIDGET (folder_browser->mail_display)); + folder_browser->mail_display = NULL; + } + folder_browser_parent_class->destroy (object); } @@ -173,6 +195,7 @@ static void folder_browser_class_init (GtkObjectClass *object_class) { object_class->destroy = folder_browser_destroy; + object_class->finalize = folder_browser_finalise; folder_browser_parent_class = gtk_type_class (PARENT_TYPE); @@ -630,6 +653,9 @@ folder_browser_copy (GtkWidget *menuitem, FolderBrowser *fb) gboolean cut; int i; + if (fb->message_list == NULL) + return; + cut = menuitem == NULL; if (!GTK_WIDGET_HAS_FOCUS (fb->message_list)) { @@ -748,6 +774,9 @@ got_folder(char *uri, CamelFolder *folder, void *data) FolderBrowser *fb = data; d(printf ("got folder '%s' = %p\n", uri, folder)); + + if (fb->message_list == NULL) + goto done; fb->folder = folder; if (folder == NULL) @@ -824,7 +853,10 @@ folder_browser_is_drafts (FolderBrowser *fb) const GSList *accounts; MailConfigAccount *account; - g_return_val_if_fail (IS_FOLDER_BROWSER (fb) && fb->uri, FALSE); + g_return_val_if_fail (IS_FOLDER_BROWSER (fb), FALSE); + + if (fb->uri == NULL) + return FALSE; if (fb->folder == drafts_folder) return TRUE; @@ -854,8 +886,11 @@ folder_browser_is_sent (FolderBrowser *fb) const GSList *accounts; MailConfigAccount *account; - g_return_val_if_fail (IS_FOLDER_BROWSER (fb) && fb->uri, FALSE); - + g_return_val_if_fail (IS_FOLDER_BROWSER (fb), FALSE); + + if (fb->uri == NULL) + return FALSE; + if (fb->folder == sent_folder) return TRUE; |