aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-08-14 06:17:00 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-08-14 06:17:00 +0800
commit106b05d139f79a88dfb0878157da074830af2904 (patch)
treef595d6c03ea6dde32e21c726026cca7581ab0736 /camel
parent681cee1a1d0000f865f96624299afc917975bc45 (diff)
downloadgsoc2013-evolution-106b05d139f79a88dfb0878157da074830af2904.tar.gz
gsoc2013-evolution-106b05d139f79a88dfb0878157da074830af2904.tar.zst
gsoc2013-evolution-106b05d139f79a88dfb0878157da074830af2904.zip
We need to be ref'ing the folder if/when we add it to the hash. This may
2001-08-13 Jeffrey Stedfast <fejj@ximian.com> * camel-store.c (camel_store_get_folder): We need to be ref'ing the folder if/when we add it to the hash. This may fix bug #6089? svn path=/trunk/; revision=11968
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog5
-rw-r--r--camel/camel-disco-store.c18
-rw-r--r--camel/camel-store.c11
-rw-r--r--camel/camel-transport.c23
-rw-r--r--camel/providers/imap/camel-imap-store.c26
-rw-r--r--camel/providers/smtp/camel-smtp-transport.c9
6 files changed, 50 insertions, 42 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 5304e9cdee..67575fc472 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,8 @@
+2001-08-13 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-store.c (camel_store_get_folder): We need to be ref'ing
+ the folder if/when we add it to the hash. This may fix bug #6089?
+
2001-08-11 Ettore Perazzoli <ettore@ximian.com>
* providers/local/camel-spool-summary.c (summary_rebuild):
diff --git a/camel/camel-disco-store.c b/camel/camel-disco-store.c
index ebe26a1908..0cc5f4feea 100644
--- a/camel/camel-disco-store.c
+++ b/camel/camel-disco-store.c
@@ -169,18 +169,18 @@ disco_get_folder (CamelStore *store, const char *name,
guint32 flags, CamelException *ex)
{
CamelDiscoStore *disco_store = CAMEL_DISCO_STORE (store);
-
+
switch (camel_disco_store_status (disco_store)) {
case CAMEL_DISCO_STORE_ONLINE:
return CDS_CLASS (store)->get_folder_online (store, name, flags, ex);
-
+
case CAMEL_DISCO_STORE_OFFLINE:
return CDS_CLASS (store)->get_folder_offline (store, name, flags, ex);
-
+
case CAMEL_DISCO_STORE_RESYNCING:
return CDS_CLASS (store)->get_folder_resyncing (store, name, flags, ex);
}
-
+
g_assert_not_reached ();
return NULL;
}
@@ -190,11 +190,11 @@ disco_get_folder_info (CamelStore *store, const char *top,
guint32 flags, CamelException *ex)
{
CamelDiscoStore *disco_store = CAMEL_DISCO_STORE (store);
-
+
switch (camel_disco_store_status (disco_store)) {
case CAMEL_DISCO_STORE_ONLINE:
return CDS_CLASS (store)->get_folder_info_online (store, top, flags, ex);
-
+
case CAMEL_DISCO_STORE_OFFLINE:
/* Can't edit subscriptions while offline */
if ((store->flags & CAMEL_STORE_SUBSCRIPTIONS) &&
@@ -202,13 +202,13 @@ disco_get_folder_info (CamelStore *store, const char *top,
camel_disco_store_check_online (disco_store, ex);
return NULL;
}
-
+
return CDS_CLASS (store)->get_folder_info_offline (store, top, flags, ex);
-
+
case CAMEL_DISCO_STORE_RESYNCING:
return CDS_CLASS (store)->get_folder_info_resyncing (store, top, flags, ex);
}
-
+
g_assert_not_reached ();
return NULL;
}
diff --git a/camel/camel-store.c b/camel/camel-store.c
index dbf0fce2e7..7abea71392 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -115,8 +115,8 @@ camel_store_init (void *o)
store->priv = g_malloc0 (sizeof (*store->priv));
#ifdef ENABLE_THREADS
- store->priv->folder_lock = g_mutex_new();
- store->priv->cache_lock = g_mutex_new();
+ store->priv->folder_lock = g_mutex_new ();
+ store->priv->cache_lock = g_mutex_new ();
#endif
}
@@ -204,9 +204,9 @@ CamelFolder *
camel_store_get_folder (CamelStore *store, const char *folder_name, guint32 flags, CamelException *ex)
{
CamelFolder *folder = NULL;
-
+
CAMEL_STORE_LOCK(store, folder_lock);
-
+
if (store->folders) {
/* Try cache first. */
CAMEL_STORE_LOCK(store, cache_lock);
@@ -227,13 +227,14 @@ camel_store_get_folder (CamelStore *store, const char *folder_name, guint32 flag
CAMEL_STORE_LOCK(store, cache_lock);
g_hash_table_insert (store->folders, g_strdup (folder_name), folder);
+ camel_object_ref (CAMEL_OBJECT (folder));
camel_object_hook_event (CAMEL_OBJECT (folder), "finalize", folder_finalize, store);
CAMEL_STORE_UNLOCK(store, cache_lock);
}
}
}
-
+
CAMEL_STORE_UNLOCK(store, folder_lock);
return folder;
}
diff --git a/camel/camel-transport.c b/camel/camel-transport.c
index 0338f5dcc0..b4d78c8d74 100644
--- a/camel/camel-transport.c
+++ b/camel/camel-transport.c
@@ -39,7 +39,7 @@ static void
camel_transport_init (gpointer object, gpointer klass)
{
CamelTransport *xport = object;
-
+
xport->priv = g_malloc0 (sizeof (struct _CamelTransportPrivate));
#ifdef ENABLE_THREADS
xport->priv->send_lock = g_mutex_new ();
@@ -60,19 +60,20 @@ camel_transport_finalize (CamelObject *object)
CamelType
camel_transport_get_type (void)
{
- static CamelType camel_transport_type = CAMEL_INVALID_TYPE;
+ static CamelType type = CAMEL_INVALID_TYPE;
- if (camel_transport_type == CAMEL_INVALID_TYPE) {
- camel_transport_type = camel_type_register (CAMEL_SERVICE_TYPE, "CamelTransport",
- sizeof (CamelTransport),
- sizeof (CamelTransportClass),
- NULL,
- NULL,
- (CamelObjectInitFunc) camel_transport_init,
- (CamelObjectFinalizeFunc) camel_transport_finalize);
+ if (type == CAMEL_INVALID_TYPE) {
+ type = camel_type_register (CAMEL_SERVICE_TYPE,
+ "CamelTransport",
+ sizeof (CamelTransport),
+ sizeof (CamelTransportClass),
+ NULL,
+ NULL,
+ (CamelObjectInitFunc) camel_transport_init,
+ (CamelObjectFinalizeFunc) camel_transport_finalize);
}
- return camel_transport_type;
+ return type;
}
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 9eff81ecf3..b4c01110ea 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -868,13 +868,13 @@ get_folder_online (CamelStore *store, const char *folder_name,
CamelImapResponse *response;
CamelFolder *new_folder;
char *folder_dir;
-
+
if (!camel_remote_store_connected (CAMEL_REMOTE_STORE (store), ex))
return NULL;
-
+
if (!g_strcasecmp (folder_name, "INBOX"))
folder_name = "INBOX";
-
+
/* Lock around the whole lot to check/create atomically */
CAMEL_IMAP_STORE_LOCK (imap_store, command_lock);
if (imap_store->current_folder) {
@@ -886,12 +886,12 @@ get_folder_online (CamelStore *store, const char *folder_name,
if (!response) {
if (!flags & CAMEL_STORE_FOLDER_CREATE)
return no_such_folder (folder_name, ex);
-
+
response = camel_imap_command (imap_store, NULL, ex,
"CREATE %F", folder_name);
if (response) {
camel_imap_response_free (imap_store, response);
-
+
response = camel_imap_command (imap_store, NULL, NULL,
"SELECT %F", folder_name);
}
@@ -900,7 +900,7 @@ get_folder_online (CamelStore *store, const char *folder_name,
return NULL;
}
}
-
+
folder_dir = e_path_to_physical (imap_store->storage_path, folder_name);
new_folder = camel_imap_folder_new (store, folder_name, folder_dir, ex);
g_free (folder_dir);
@@ -916,9 +916,9 @@ get_folder_online (CamelStore *store, const char *folder_name,
}
}
camel_imap_response_free_without_processing (imap_store, response);
-
+
CAMEL_IMAP_STORE_UNLOCK (imap_store, command_lock);
-
+
return new_folder;
}
@@ -929,21 +929,21 @@ get_folder_offline (CamelStore *store, const char *folder_name,
CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
CamelFolder *new_folder;
char *folder_dir;
-
+
if (!imap_store->connected &&
!camel_service_connect (CAMEL_SERVICE (store), ex))
return NULL;
-
+
if (!g_strcasecmp (folder_name, "INBOX"))
folder_name = "INBOX";
-
+
folder_dir = e_path_to_physical (imap_store->storage_path, folder_name);
if (access (folder_dir, F_OK) != 0)
return no_such_folder (folder_name, ex);
-
+
new_folder = camel_imap_folder_new (store, folder_name, folder_dir, ex);
g_free (folder_dir);
-
+
return new_folder;
}
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index f7749f4216..1f3abf987d 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -112,7 +112,7 @@ camel_smtp_transport_class_init (CamelSmtpTransportClass *camel_smtp_transport_c
camel_service_class->disconnect = smtp_disconnect;
camel_service_class->query_auth_types = query_auth_types;
camel_service_class->get_name = get_name;
-
+
camel_transport_class->can_send = smtp_can_send;
camel_transport_class->send = smtp_send;
camel_transport_class->send_to = smtp_send_to;
@@ -133,7 +133,8 @@ camel_smtp_transport_get_type (void)
if (camel_smtp_transport_type == CAMEL_INVALID_TYPE) {
camel_smtp_transport_type =
- camel_type_register (CAMEL_TRANSPORT_TYPE, "CamelSmtpTransport",
+ camel_type_register (CAMEL_TRANSPORT_TYPE,
+ "CamelSmtpTransport",
sizeof (CamelSmtpTransport),
sizeof (CamelSmtpTransportClass),
(CamelObjectClassInitFunc) camel_smtp_transport_class_init,
@@ -151,9 +152,9 @@ smtp_construct (CamelService *service, CamelSession *session,
CamelException *ex)
{
CamelSmtpTransport *smtp_transport = CAMEL_SMTP_TRANSPORT (service);
-
+
CAMEL_SERVICE_CLASS (parent_class)->construct (service, session, provider, url, ex);
-
+
if (camel_url_get_param (url, "use_ssl"))
smtp_transport->use_ssl = TRUE;
}