diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | camel/camel-folder.c | 20 | ||||
-rw-r--r-- | camel/camel-mime-body-part.c | 2 | ||||
-rw-r--r-- | camel/camel-mime-message.c | 3 | ||||
-rw-r--r-- | camel/camel-service.c | 17 | ||||
-rw-r--r-- | camel/camel-store.c | 22 | ||||
-rw-r--r-- | camel/camel-stream-fs.c | 40 | ||||
-rw-r--r-- | camel/camel-stream-mem.c | 19 | ||||
-rw-r--r-- | tests/ui-tests/store_listing.c | 17 |
9 files changed, 138 insertions, 9 deletions
@@ -1,10 +1,17 @@ 1999-08-11 bertrand <Bertrand.Guiheneuf@aful.org> + * camel/camel-service.c (_finalize): + * camel/camel-stream-fs.c (_finalize): + (_destroy): close file descriptor. + * camel/camel-stream-mem.c (_finalize): + * camel/camel-store.c (_finalize): + * camel/camel-folder.c (_finalize): * camel/camel-multipart.c (_finalize): * camel/camel-simple-data-wrapper.c (_finalize): * camel/camel-mime-part.c (_finalize): implemented destructors. + * camel/gmime-content-field.c (gmime_content_field_ref): (gmime_content_field_unref): New reference mechanism for GMimeContentField objects. diff --git a/camel/camel-folder.c b/camel/camel-folder.c index 2d0a29faab..1ea2a7247b 100644 --- a/camel/camel-folder.c +++ b/camel/camel-folder.c @@ -22,6 +22,7 @@ */ #include <config.h> #include "camel-folder.h" +#include "camel-log.h" #include "string-utils.h" static GtkObjectClass *parent_class=NULL; @@ -53,10 +54,13 @@ static CamelMimeMessage *_get_message (CamelFolder *folder, gint number); static gint _get_message_count (CamelFolder *folder); static gint _append_message (CamelFolder *folder, CamelMimeMessage *message); +static void _finalize (GtkObject *object); static void camel_folder_class_init (CamelFolderClass *camel_folder_class) { + GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_folder_class); + parent_class = gtk_type_class (gtk_object_get_type ()); /* virtual method definition */ @@ -83,6 +87,7 @@ camel_folder_class_init (CamelFolderClass *camel_folder_class) camel_folder_class->append_message = _append_message; /* virtual method overload */ + gtk_object_class->finalize = _finalize; } @@ -116,6 +121,18 @@ camel_folder_get_type (void) } +static void +_finalize (GtkObject *object) +{ + CamelFolder *camel_folder = CAMEL_FOLDER (object); + CAMEL_LOG_FULL_DEBUG ("Entering CamelFolder::finalize\n"); + + if (camel_folder->name) g_free (camel_folder->name); + if (camel_folder->full_name) g_free (camel_folder->full_name); + + GTK_OBJECT_CLASS (parent_class)->finalize (object); + CAMEL_LOG_FULL_DEBUG ("Leaving CamelFolder::finalize\n"); +} /** @@ -131,7 +148,9 @@ _init_with_store (CamelFolder *folder, CamelStore *parent_store) g_assert(folder); g_assert(parent_store); + if (folder->parent_store) gtk_object_unref (GTK_OBJECT (folder->parent_store)); folder->parent_store = parent_store; + if (parent_store) gtk_object_ref (GTK_OBJECT (parent_store)); } @@ -455,7 +474,6 @@ _create(CamelFolder *folder) } else { parent = camel_store_get_folder (folder->parent_store, prefix); camel_folder_create (parent); - gtk_object_unref (GTK_OBJECT (parent)); } } } diff --git a/camel/camel-mime-body-part.c b/camel/camel-mime-body-part.c index 3b0c547bfa..570c2fe6d4 100644 --- a/camel/camel-mime-body-part.c +++ b/camel/camel-mime-body-part.c @@ -96,7 +96,9 @@ camel_mime_body_part_new () static void _set_parent (CamelMimeBodyPart *mime_body_part, CamelMultipart *multipart) { + if (mime_body_part->parent) gtk_object_unref (GTK_OBJECT (mime_body_part->parent)); mime_body_part->parent = multipart; + if (multipart) gtk_object_ref (GTK_OBJECT (multipart)); } diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c index 1563c0cb1d..acff82ca71 100644 --- a/camel/camel-mime-message.c +++ b/camel/camel-mime-message.c @@ -99,7 +99,7 @@ camel_mime_message_class_init (CamelMimeMessageClass *camel_mime_message_class) { CamelDataWrapperClass *camel_data_wrapper_class = CAMEL_DATA_WRAPPER_CLASS (camel_mime_message_class); CamelMimePartClass *camel_mime_part_class = CAMEL_MIME_PART_CLASS (camel_mime_message_class); - GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_data_wrapper_class); + GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_mime_message_class); parent_class = gtk_type_class (camel_mime_part_get_type ()); _init_header_name_table(); @@ -656,5 +656,6 @@ _parse_header_pair (CamelMimePart *mime_part, gchar *header_name, gchar *header_ return TRUE; } else return parent_class->parse_header_pair (mime_part, header_name, header_value); + } diff --git a/camel/camel-service.c b/camel/camel-service.c index 0a27eb78fe..cdbb679dd0 100644 --- a/camel/camel-service.c +++ b/camel/camel-service.c @@ -22,6 +22,7 @@ */ #include <config.h> #include "camel-service.h" +#include "camel-log.h" static GtkObjectClass *parent_class=NULL; @@ -34,10 +35,13 @@ static void _connect_to_with_login_passwd_port (CamelService *service, gchar *ho static gboolean _is_connected (CamelService *service); static void _set_connected (CamelService *service, gboolean state); static const gchar *_get_url (CamelService *service); +static void _finalize (GtkObject *object); static void camel_service_class_init (CamelServiceClass *camel_service_class) { + GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_service_class); + parent_class = gtk_type_class (gtk_object_get_type ()); /* virtual method definition */ @@ -49,6 +53,7 @@ camel_service_class_init (CamelServiceClass *camel_service_class) camel_service_class->get_url = _get_url; /* virtual method overload */ + gtk_object_class->finalize = _finalize; } @@ -82,6 +87,18 @@ camel_service_get_type (void) } +static void +_finalize (GtkObject *object) +{ + CamelService *camel_service = CAMEL_SERVICE (object); + + CAMEL_LOG_FULL_DEBUG ("Entering CamelService::finalize\n"); + + if (camel_service->url) g_free (camel_service->url); + + GTK_OBJECT_CLASS (parent_class)->finalize (object); + CAMEL_LOG_FULL_DEBUG ("Leaving CamelService::finalize\n"); +} diff --git a/camel/camel-store.c b/camel/camel-store.c index a6fb1a303e..2168b3732c 100644 --- a/camel/camel-store.c +++ b/camel/camel-store.c @@ -22,6 +22,7 @@ */ #include <config.h> #include "camel-store.h" +#include "camel-log.h" static CamelServiceClass *parent_class = NULL; @@ -35,10 +36,13 @@ static void _init(CamelStore *store, CamelSession *session, gchar *url_name); static CamelFolder *_get_folder (CamelStore *store, const gchar *folder_name); static gchar _get_separator (CamelStore *store); +static void _finalize (GtkObject *object); static void camel_store_class_init (CamelStoreClass *camel_store_class) { + GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_store_class); + parent_class = gtk_type_class (camel_service_get_type ()); /* virtual method definition */ @@ -48,7 +52,9 @@ camel_store_class_init (CamelStoreClass *camel_store_class) camel_store_class->get_folder = _get_folder; camel_store_class->get_root_folder = _get_root_folder; camel_store_class->get_default_folder = _get_default_folder; + /* virtual method overload */ + gtk_object_class->finalize = _finalize; } @@ -122,11 +128,27 @@ _init (CamelStore *store, CamelSession *session, gchar *url_name) /* g_assert(session); */ g_assert(url_name); + if (store->session) gtk_object_unref (GTK_OBJECT (store->session)); store->session = session; + gtk_object_ref (GTK_OBJECT (session)); store->url_name = url_name; } +static void +_finalize (GtkObject *object) +{ + CamelStore *camel_store = CAMEL_STORE (object); + CAMEL_LOG_FULL_DEBUG ("Entering CamelStore::finalize\n"); + + if (camel_store->url_name) g_free (camel_store->url_name); + if (camel_store->session) gtk_object_unref (GTK_OBJECT (camel_store->session)); + + GTK_OBJECT_CLASS (parent_class)->finalize (object); + CAMEL_LOG_FULL_DEBUG ("Leaving CamelStore::finalize\n"); +} + + /** * camel_store_set_separator: set the character which separates this folder path from the folders names in a lower level of hierarchy. diff --git a/camel/camel-stream-fs.c b/camel/camel-stream-fs.c index a8e0dcb6c4..340a87606c 100644 --- a/camel/camel-stream-fs.c +++ b/camel/camel-stream-fs.c @@ -43,11 +43,15 @@ static gboolean _eos (CamelStream *stream); static void _close (CamelStream *stream); static gint _seek (CamelStream *stream, gint offset, CamelStreamSeekPolicy policy); +static void _finalize (GtkObject *object); +static void _destroy (GtkObject *object); static void camel_stream_fs_class_init (CamelStreamFsClass *camel_stream_fs_class) { CamelStreamClass *camel_stream_class = CAMEL_STREAM_CLASS (camel_stream_fs_class); + GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_stream_fs_class); + parent_class = gtk_type_class (gtk_object_get_type ()); /* virtual method definition */ @@ -61,6 +65,9 @@ camel_stream_fs_class_init (CamelStreamFsClass *camel_stream_fs_class) camel_stream_class->close = _close; camel_stream_class->seek = _seek; + gtk_object_class->finalize = _finalize; + gtk_object_class->finalize = _destroy; + } @@ -90,6 +97,39 @@ camel_stream_fs_get_type (void) } +static void +_destroy (GtkObject *object) +{ + CamelStreamFs *stream_fs = CAMEL_STREAM_FS (object); + gint close_error; + + CAMEL_LOG_FULL_DEBUG ("Entering CamelStreamFs::destroy\n"); + + close_error = close (stream_fs->fd); + if (close_error) { + CAMEL_LOG_FULL_DEBUG ("CamelStreamFs::destroy Error while closing file descriptor\n"); + CAMEL_LOG_FULL_DEBUG ( " Full error text is : %s\n", strerror(errno)); + } + GTK_OBJECT_CLASS (parent_class)->destroy (object); + CAMEL_LOG_FULL_DEBUG ("Leaving CamelStreamFs::destroy\n"); +} + + +static void +_finalize (GtkObject *object) +{ + CamelStreamFs *stream_fs = CAMEL_STREAM_FS (object); + + + CAMEL_LOG_FULL_DEBUG ("Entering CamelStreamFs::finalize\n"); + + if (stream_fs->name) g_free (stream_fs->name); + + GTK_OBJECT_CLASS (parent_class)->finalize (object); + CAMEL_LOG_FULL_DEBUG ("Leaving CamelStreamFs::finalize\n"); +} + + CamelStream * camel_stream_fs_new_with_name (gchar *name, CamelStreamFsMode mode) { diff --git a/camel/camel-stream-mem.c b/camel/camel-stream-mem.c index 2fa2c7c306..592caa5063 100644 --- a/camel/camel-stream-mem.c +++ b/camel/camel-stream-mem.c @@ -43,11 +43,14 @@ static gboolean _eos (CamelStream *stream); static void _close (CamelStream *stream); static gint _seek (CamelStream *stream, gint offset, CamelStreamSeekPolicy policy); +static void _finalize (GtkObject *object); static void camel_stream_mem_class_init (CamelStreamMemClass *camel_stream_mem_class) { CamelStreamClass *camel_stream_class = CAMEL_STREAM_CLASS (camel_stream_mem_class); + GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_stream_mem_class); + parent_class = gtk_type_class (gtk_object_get_type ()); /* virtual method definition */ @@ -61,6 +64,8 @@ camel_stream_mem_class_init (CamelStreamMemClass *camel_stream_mem_class) camel_stream_class->close = _close; camel_stream_class->seek = _seek; + gtk_object_class->finalize = _finalize; + } static void @@ -106,6 +111,20 @@ camel_stream_mem_new (CamelStreamMemMode mode) return CAMEL_STREAM (stream_mem); } +static void +_finalize (GtkObject *object) +{ + CamelStreamMem *stream_mem = CAMEL_STREAM_MEM (object); + + + CAMEL_LOG_FULL_DEBUG ("Entering CamelStreamMem::finalize\n"); + g_byte_array_free (stream_mem->buffer, TRUE); + + GTK_OBJECT_CLASS (parent_class)->finalize (object); + CAMEL_LOG_FULL_DEBUG ("Leaving CamelStreamMem::finalize\n"); +} + + /** * _read: read bytes from a stream diff --git a/tests/ui-tests/store_listing.c b/tests/ui-tests/store_listing.c index 34c0e51a28..2f73921ad6 100644 --- a/tests/ui-tests/store_listing.c +++ b/tests/ui-tests/store_listing.c @@ -60,7 +60,7 @@ show_folder_messages (CamelFolder *folder) gint folder_message_count; CamelMimeMessage *message; gint i; - gchar *clist_row_text[3]; + const gchar *clist_row_text[3]; const char *sent_date, *subject, *sender; gint current_row; @@ -77,16 +77,19 @@ show_folder_messages (CamelFolder *folder) sender = camel_mime_message_get_from (message); subject = camel_mime_message_get_subject (message); - if (sent_date) clist_row_text [0] = g_strdup (sent_date); - else clist_row_text [0] = g_strdup ('\0'); - if (sender) clist_row_text [1] = g_strdup (sender); - else clist_row_text [1] = g_strdup ('\0'); - if (subject) clist_row_text [2] = g_strdup (subject); - else clist_row_text [2] = g_strdup ('\0'); + + if (sent_date) clist_row_text [0] = sent_date; + else clist_row_text [0] = NULL; + if (sender) clist_row_text [1] = sender; + else clist_row_text [1] = NULL; + if (subject) clist_row_text [2] = subject; + else clist_row_text [2] = NULL; current_row = gtk_clist_append (GTK_CLIST (message_clist), clist_row_text); gtk_clist_set_row_data_full (GTK_CLIST (message_clist), current_row, (gpointer)message, message_destroy_notify); } + for (i=0; i<10; i++) + gtk_clist_append (GTK_CLIST (message_clist), clist_row_text); |