[evolution-mapi] Replace deprecated GLib symbols (as of GLib 2.34.x)
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-mapi] Replace deprecated GLib symbols (as of GLib 2.34.x)
- Date: Tue, 6 Nov 2012 16:03:39 +0000 (UTC)
commit 24a0c1e9dda2bf3f98e2f553c2800e79350355a0
Author: Milan Crha <mcrha redhat com>
Date: Tue Nov 6 17:01:17 2012 +0100
Replace deprecated GLib symbols (as of GLib 2.34.x)
src/addressbook/e-book-backend-mapi.c | 8 +-
src/calendar/e-cal-backend-mapi.c | 141 ++++++++++++--------------
src/camel/camel-mapi-folder.c | 22 +++-
src/camel/camel-mapi-store.c | 38 ++++----
src/configuration/e-mapi-config-utils.c | 13 ++-
src/configuration/e-mapi-search-gal-user.c | 5 +-
src/libexchangemapi/camel-mapi-settings.c | 36 ++++----
src/libexchangemapi/e-mapi-cal-tz-utils.c | 42 ++++----
src/libexchangemapi/e-mapi-connection.c | 20 ++--
src/libexchangemapi/e-mapi-operation-queue.c | 10 +-
src/libexchangemapi/e-mapi-utils.c | 6 +-
src/libexchangemapi/e-source-mapi-folder.c | 16 ++--
12 files changed, 186 insertions(+), 171 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-mapi.c b/src/addressbook/e-book-backend-mapi.c
index 9bcfb89..8895112 100644
--- a/src/addressbook/e-book-backend-mapi.c
+++ b/src/addressbook/e-book-backend-mapi.c
@@ -346,7 +346,7 @@ ebbm_maybe_invoke_cache_update (EBookBackendMAPI *ebma)
g_cancellable_reset (priv->update_cache);
priv->server_dirty = FALSE;
- priv->update_cache_thread = g_thread_create (ebbm_update_cache_cb, ebma, TRUE, NULL);
+ priv->update_cache_thread = g_thread_new (NULL, ebbm_update_cache_cb, ebma);
if (!priv->update_cache_thread)
g_object_unref (ebma);
}
@@ -1053,6 +1053,7 @@ ebbm_operation_cb (OperationBase *op, gboolean cancelled, EBookBackend *backend)
OperationBookView *opbv = (OperationBookView *) op;
if (!cancelled && e_book_backend_mapi_book_view_is_running (ebma, opbv->book_view)) {
+ GThread *thread;
GError *err = NULL;
struct BookViewThreadData *bvtd = g_new0 (struct BookViewThreadData, 1);
@@ -1067,7 +1068,7 @@ ebbm_operation_cb (OperationBase *op, gboolean cancelled, EBookBackend *backend)
g_mutex_unlock (&ebma->priv->running_views_lock);
- g_thread_create (ebbm_book_view_thread, bvtd, FALSE, &err);
+ thread = g_thread_try_new (NULL, ebbm_book_view_thread, bvtd, &err);
if (err) {
error = EDB_ERROR_EX (OTHER_ERROR, err->message);
@@ -1075,6 +1076,9 @@ ebbm_operation_cb (OperationBase *op, gboolean cancelled, EBookBackend *backend)
g_error_free (error);
g_error_free (err);
}
+
+ if (thread)
+ g_thread_unref (thread);
}
g_object_unref (opbv->book_view);
diff --git a/src/calendar/e-cal-backend-mapi.c b/src/calendar/e-cal-backend-mapi.c
index 364556b..9a61b18 100644
--- a/src/calendar/e-cal-backend-mapi.c
+++ b/src/calendar/e-cal-backend-mapi.c
@@ -62,8 +62,8 @@ G_DEFINE_TYPE_WITH_CODE (ECalBackendMAPI, e_cal_backend_mapi, E_TYPE_CAL_BACKEND
G_IMPLEMENT_INTERFACE (E_TYPE_SOURCE_AUTHENTICATOR, e_cal_backend_mapi_authenticator_init))
typedef struct {
- GCond *cond;
- GMutex *mutex;
+ GCond cond;
+ GMutex mutex;
gboolean exit;
} SyncDelta;
@@ -77,13 +77,13 @@ struct _ECalBackendMAPIPrivate {
EMapiConnection *conn;
/* A mutex to control access to the private structure */
- GMutex *mutex;
+ GMutex mutex;
ECalBackendStore *store;
gboolean read_only;
gchar *uri;
gboolean mode_changed;
- GMutex *updating_mutex;
- GMutex *is_updating_mutex;
+ GMutex updating_mutex;
+ GMutex is_updating_mutex;
gboolean is_updating;
/* timeout handler for syncing sendoptions */
@@ -157,7 +157,7 @@ static void e_cal_backend_mapi_maybe_disconnect (ECalBackendMAPI *cbma, const G
#define CACHE_REFRESH_INTERVAL 600000
-static GStaticMutex auth_mutex = G_STATIC_MUTEX_INIT;
+static GMutex auth_mutex;
static void
mapi_error_to_edc_error (GError **perror, const GError *mapi_error, EDataCalCallStatus code, const gchar *context)
@@ -375,8 +375,8 @@ ecbm_refresh (ECalBackend *backend, EDataCal *cal, GCancellable *cancellable, GE
cbmapi = E_CAL_BACKEND_MAPI (backend);
priv = cbmapi->priv;
- if (priv && priv->dlock && priv->dlock->cond)
- g_cond_signal (priv->dlock->cond);
+ if (priv && priv->dlock)
+ g_cond_signal (&priv->dlock->cond);
}
#if 0
@@ -770,11 +770,11 @@ update_local_cache (ECalBackendMAPI *cbmapi, GCancellable *cancellable)
if (!e_backend_get_online (E_BACKEND (cbmapi)))
return FALSE;
- g_mutex_lock (priv->is_updating_mutex);
+ g_mutex_lock (&priv->is_updating_mutex);
priv->is_updating = TRUE;
- g_mutex_unlock (priv->is_updating_mutex);
+ g_mutex_unlock (&priv->is_updating_mutex);
- g_mutex_lock (priv->updating_mutex);
+ g_mutex_lock (&priv->updating_mutex);
conn = e_cal_backend_mapi_get_connection (cbmapi, cancellable, &mapi_error);
if (!conn) {
@@ -888,11 +888,11 @@ update_local_cache (ECalBackendMAPI *cbmapi, GCancellable *cancellable)
cleanup:
if (conn)
g_object_unref (conn);
- g_mutex_unlock (priv->updating_mutex);
+ g_mutex_unlock (&priv->updating_mutex);
- g_mutex_lock (priv->is_updating_mutex);
+ g_mutex_lock (&priv->is_updating_mutex);
priv->is_updating = FALSE;
- g_mutex_unlock (priv->is_updating_mutex);
+ g_mutex_unlock (&priv->is_updating_mutex);
notify_view_completed (cbmapi);
@@ -911,7 +911,7 @@ ecbm_get_object (ECalBackend *backend, EDataCal *cal, GCancellable *cancellable,
priv = cbmapi->priv;
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
/* search the object in the cache */
comp = e_cal_backend_store_get_component (priv->store, uid, rid);
@@ -920,14 +920,14 @@ ecbm_get_object (ECalBackend *backend, EDataCal *cal, GCancellable *cancellable,
/* the object is not in the backend store, double check that it's
* also not on the server to prevent for a race condition where we
* might otherwise mistakenly generate a new UID */
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
update_local_cache (cbmapi, cancellable);
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
comp = e_cal_backend_store_get_component (priv->store, uid, rid);
}
if (comp) {
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
if (e_cal_backend_get_kind (E_CAL_BACKEND (backend)) ==
icalcomponent_isa (e_cal_component_get_icalcomponent (comp)))
*object = e_cal_component_get_as_string (comp);
@@ -937,7 +937,7 @@ ecbm_get_object (ECalBackend *backend, EDataCal *cal, GCancellable *cancellable,
g_object_unref (comp);
} else {
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
}
if (!object || !*object)
@@ -958,7 +958,7 @@ ecbm_get_object_list (ECalBackend *backend, EDataCal *cal, GCancellable *cancell
cbmapi = E_CAL_BACKEND_MAPI (backend);
priv = cbmapi->priv;
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
if (!strcmp (sexp, "#t"))
search_needed = FALSE;
@@ -966,7 +966,7 @@ ecbm_get_object_list (ECalBackend *backend, EDataCal *cal, GCancellable *cancell
cbsexp = e_cal_backend_sexp_new (sexp);
if (!cbsexp) {
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
g_propagate_error (perror, EDC_ERROR (InvalidQuery));
return;
}
@@ -991,7 +991,7 @@ ecbm_get_object_list (ECalBackend *backend, EDataCal *cal, GCancellable *cancell
g_slist_free_full (components, g_object_unref);
g_object_unref (cbsexp);
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
}
static void
@@ -1023,7 +1023,7 @@ delta_thread (gpointer data)
ECalBackendMAPI *cbmapi;
ECalBackendMAPIPrivate *priv;
GCancellable *cancellable;
- GTimeVal timeout;
+ gint64 end_time;
cbmapi = (ECalBackendMAPI *)(data);
g_return_val_if_fail (E_IS_CAL_BACKEND_MAPI (cbmapi), NULL);
@@ -1031,29 +1031,25 @@ delta_thread (gpointer data)
priv = cbmapi->priv;
cancellable = g_object_ref (priv->cancellable);
- timeout.tv_sec = 0;
- timeout.tv_usec = 0;
-
while (!g_cancellable_is_cancelled (cancellable)) {
update_local_cache (cbmapi, cancellable);
- g_mutex_lock (priv->dlock->mutex);
+ g_mutex_lock (&priv->dlock->mutex);
if (priv->dlock->exit)
break;
- g_get_current_time (&timeout);
- g_time_val_add (&timeout, get_cache_refresh_interval () * 1000);
- g_cond_timed_wait (priv->dlock->cond, priv->dlock->mutex, &timeout);
+ end_time = g_get_monotonic_time () + get_cache_refresh_interval () * G_TIME_SPAN_SECOND;
+ g_cond_wait_until (&priv->dlock->cond, &priv->dlock->mutex, end_time);
if (priv->dlock->exit)
break;
- g_mutex_unlock (priv->dlock->mutex);
+ g_mutex_unlock (&priv->dlock->mutex);
}
g_object_unref (cancellable);
- g_mutex_unlock (priv->dlock->mutex);
+ g_mutex_unlock (&priv->dlock->mutex);
priv->dthread = NULL;
return NULL;
@@ -1071,21 +1067,21 @@ run_delta_thread (ECalBackendMAPI *cbmapi)
/* If the thread is already running just return back */
if (priv->dthread) {
- g_cond_signal (priv->dlock->cond);
+ g_cond_signal (&priv->dlock->cond);
return;
}
if (!priv->dlock) {
priv->dlock = g_new0 (SyncDelta, 1);
- priv->dlock->mutex = g_mutex_new ();
- priv->dlock->cond = g_cond_new ();
+ g_mutex_init (&priv->dlock->mutex);
+ g_cond_init (&priv->dlock->cond);
}
priv->dlock->exit = FALSE;
- priv->dthread = g_thread_create ((GThreadFunc) delta_thread, cbmapi, TRUE, &error);
+ priv->dthread = g_thread_try_new (NULL, (GThreadFunc) delta_thread, cbmapi, &error);
if (!priv->dthread) {
- g_warning (G_STRLOC ": %s", error->message);
- g_error_free (error);
+ g_warning (G_STRLOC ": %s", error ? error->message : "Unknown error");
+ g_clear_error (&error);
}
}
@@ -1169,7 +1165,7 @@ ecbm_connect_user (ECalBackend *backend,
EMapiConnection *old_conn;
GError *mapi_error = NULL;
- g_static_mutex_lock (&auth_mutex);
+ g_mutex_lock (&auth_mutex);
cbmapi = E_CAL_BACKEND_MAPI (backend);
priv = cbmapi->priv;
@@ -1221,18 +1217,18 @@ ecbm_connect_user (ECalBackend *backend,
mapi_error_to_edc_error (perror, mapi_error, OtherError, NULL);
if (mapi_error)
g_error_free (mapi_error);
- g_static_mutex_unlock (&auth_mutex);
+ g_mutex_unlock (&auth_mutex);
return is_network_error ? E_SOURCE_AUTHENTICATION_ERROR : E_SOURCE_AUTHENTICATION_REJECTED;
}
if (mapi_error) {
/* do not set error when authentication was rejected */
g_error_free (mapi_error);
- g_static_mutex_unlock (&auth_mutex);
+ g_mutex_unlock (&auth_mutex);
return E_SOURCE_AUTHENTICATION_REJECTED;
}
- g_static_mutex_unlock (&auth_mutex);
+ g_mutex_unlock (&auth_mutex);
if (!priv->fid) {
g_propagate_error (perror, EDC_ERROR_EX (OtherError, "No folder ID set"));
@@ -1362,7 +1358,7 @@ ecbm_open (ECalBackend *backend,
return;
}
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
cbmapi->priv->read_only = FALSE;
@@ -1376,7 +1372,7 @@ ecbm_open (ECalBackend *backend,
priv->store = e_cal_backend_file_store_new (cache_dir);
if (!priv->store) {
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
g_propagate_error (perror, EDC_ERROR_EX (OtherError, _("Could not create cache file")));
e_cal_backend_notify_opened (backend, EDC_ERROR_EX (OtherError, _("Could not create cache file")));
return;
@@ -1393,13 +1389,13 @@ ecbm_open (ECalBackend *backend,
offline_extension = e_source_get_extension (esource, E_SOURCE_EXTENSION_OFFLINE);
if (!e_source_offline_get_stay_synchronized (offline_extension)) {
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
g_propagate_error (perror, EDC_ERROR (RepositoryOffline));
e_cal_backend_notify_opened (backend, EDC_ERROR (RepositoryOffline));
return;
}
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
e_cal_backend_notify_online (backend, FALSE);
e_cal_backend_notify_readonly (backend, priv->read_only);
e_cal_backend_notify_opened (backend, NULL);
@@ -1417,7 +1413,7 @@ ecbm_open (ECalBackend *backend,
priv->foreign_username = NULL;
}
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
e_cal_backend_notify_online (backend, TRUE);
e_cal_backend_notify_readonly (backend, priv->read_only);
@@ -2325,9 +2321,9 @@ ecbm_receive_objects (ECalBackend *backend, EDataCal *cal, GCancellable *cancell
case ICAL_METHOD_REPLY : {
ECalComponent *cache_comp;
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
cache_comp = e_cal_backend_store_get_component (priv->store, uid, NULL);
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
if (cache_comp) {
gboolean any_changed = FALSE;
GSList *reply_attendees = NULL, *ri, *cache_attendees = NULL, *ci;
@@ -2507,12 +2503,12 @@ ecbm_start_view (ECalBackend *backend, EDataCalView *view)
cbmapi = E_CAL_BACKEND_MAPI (backend);
priv = cbmapi->priv;
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
cbsexp = e_data_cal_view_get_sexp (view);
if (!cbsexp) {
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
err = EDC_ERROR (InvalidQuery);
e_data_cal_view_notify_complete (view, err);
@@ -2543,12 +2539,12 @@ ecbm_start_view (ECalBackend *backend, EDataCalView *view)
}
g_slist_free_full (components, g_object_unref);
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
- g_mutex_lock (priv->is_updating_mutex);
+ g_mutex_lock (&priv->is_updating_mutex);
if (!priv->is_updating)
e_data_cal_view_notify_complete (view, NULL /* Success */);
- g_mutex_unlock (priv->is_updating_mutex);
+ g_mutex_unlock (&priv->is_updating_mutex);
}
static void
@@ -2563,7 +2559,7 @@ ecbm_notify_online_cb (ECalBackend *backend, GParamSpec *pspec)
online = e_backend_get_online (E_BACKEND (backend));
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
priv->mode_changed = TRUE;
if (online) {
@@ -2577,7 +2573,7 @@ ecbm_notify_online_cb (ECalBackend *backend, GParamSpec *pspec)
e_cal_backend_notify_readonly (backend, priv->read_only);
e_cal_backend_notify_online (backend, online);
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
}
static icaltimezone *
@@ -3498,17 +3494,17 @@ ecbm_finalize (GObject *object)
}
if (priv->dlock) {
- g_mutex_lock (priv->dlock->mutex);
+ g_mutex_lock (&priv->dlock->mutex);
priv->dlock->exit = TRUE;
- g_mutex_unlock (priv->dlock->mutex);
+ g_mutex_unlock (&priv->dlock->mutex);
- g_cond_signal (priv->dlock->cond);
+ g_cond_signal (&priv->dlock->cond);
if (priv->dthread)
g_thread_join (priv->dthread);
- g_mutex_free (priv->dlock->mutex);
- g_cond_free (priv->dlock->cond);
+ g_mutex_clear (&priv->dlock->mutex);
+ g_cond_clear (&priv->dlock->cond);
g_free (priv->dlock);
priv->dthread = NULL;
}
@@ -3518,20 +3514,9 @@ ecbm_finalize (GObject *object)
priv->op_queue = NULL;
}
- if (priv->mutex) {
- g_mutex_free (priv->mutex);
- priv->mutex = NULL;
- }
-
- if (priv->updating_mutex) {
- g_mutex_free (priv->updating_mutex);
- priv->updating_mutex = NULL;
- }
-
- if (priv->is_updating_mutex) {
- g_mutex_free (priv->is_updating_mutex);
- priv->is_updating_mutex = NULL;
- }
+ g_mutex_clear (&priv->mutex);
+ g_mutex_clear (&priv->updating_mutex);
+ g_mutex_clear (&priv->is_updating_mutex);
if (priv->store) {
g_object_unref (priv->store);
@@ -3612,9 +3597,9 @@ e_cal_backend_mapi_init (ECalBackendMAPI *cbmapi)
priv->sendoptions_sync_timeout = 0;
/* create the mutex for thread safety */
- priv->mutex = g_mutex_new ();
- priv->updating_mutex = g_mutex_new ();
- priv->is_updating_mutex = g_mutex_new ();
+ g_mutex_init (&priv->mutex);
+ g_mutex_init (&priv->updating_mutex);
+ g_mutex_init (&priv->is_updating_mutex);
priv->is_updating = FALSE;
priv->op_queue = e_mapi_operation_queue_new ((EMapiOperationQueueFunc) ecbm_operation_cb, cbmapi);
priv->last_refresh = -1;
diff --git a/src/camel/camel-mapi-folder.c b/src/camel/camel-mapi-folder.c
index 451c418..b78d31b 100644
--- a/src/camel/camel-mapi-folder.c
+++ b/src/camel/camel-mapi-folder.c
@@ -47,14 +47,14 @@
#define d(x)
#define CAMEL_MAPI_FOLDER_LOCK(f, l) \
- (g_static_mutex_lock(&((CamelMapiFolder *)f)->priv->l))
+ (g_mutex_lock(&((CamelMapiFolder *)f)->priv->l))
#define CAMEL_MAPI_FOLDER_UNLOCK(f, l) \
- (g_static_mutex_unlock(&((CamelMapiFolder *)f)->priv->l))
+ (g_mutex_unlock(&((CamelMapiFolder *)f)->priv->l))
extern gint camel_application_is_exiting;
struct _CamelMapiFolderPrivate {
- GStaticMutex search_lock; /* for locking the search object */
+ GMutex search_lock; /* for locking the search object */
gchar *foreign_username;
};
@@ -1106,6 +1106,17 @@ mapi_folder_dispose (GObject *object)
}
static void
+mapi_folder_finalize (GObject *object)
+{
+ CamelMapiFolder *mapi_folder = CAMEL_MAPI_FOLDER (object);
+
+ g_mutex_clear (&mapi_folder->priv->search_lock);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (camel_mapi_folder_parent_class)->finalize (object);
+}
+
+static void
mapi_folder_constructed (GObject *object)
{
CamelNetworkSettings *network_settings;
@@ -1966,6 +1977,7 @@ camel_mapi_folder_class_init (CamelMapiFolderClass *class)
object_class = G_OBJECT_CLASS (class);
object_class->dispose = mapi_folder_dispose;
+ object_class->finalize = mapi_folder_finalize;
object_class->constructed = mapi_folder_constructed;
folder_class = CAMEL_FOLDER_CLASS (class);
@@ -1997,9 +2009,7 @@ camel_mapi_folder_init (CamelMapiFolder *mapi_folder)
folder->folder_flags = CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY;
-#ifdef ENABLE_THREADS
- g_static_mutex_init(&mapi_folder->priv->search_lock);
-#endif
+ g_mutex_init (&mapi_folder->priv->search_lock);
mapi_folder->need_rescan = TRUE;
}
diff --git a/src/camel/camel-mapi-store.c b/src/camel/camel-mapi-store.c
index 391746f..6738468 100644
--- a/src/camel/camel-mapi-store.c
+++ b/src/camel/camel-mapi-store.c
@@ -63,7 +63,7 @@ struct _CamelMapiStorePrivate {
gboolean folders_synced; /* whether were synced folder list already */
- GStaticRecMutex updates_lock;
+ GRecMutex updates_lock;
GCancellable *updates_cancellable; /* cancelled on dispose or disconnect */
GSList *update_folder_names; /* gchar *foldername */
guint update_folder_id;
@@ -965,7 +965,7 @@ stop_pending_updates (CamelMapiStore *mapi_store)
priv = mapi_store->priv;
- g_static_rec_mutex_lock (&priv->updates_lock);
+ g_rec_mutex_lock (&priv->updates_lock);
if (priv->updates_cancellable) {
g_cancellable_cancel (priv->updates_cancellable);
g_object_unref (priv->updates_cancellable);
@@ -987,7 +987,7 @@ stop_pending_updates (CamelMapiStore *mapi_store)
priv->update_folder_list_id = 0;
}
- g_static_rec_mutex_unlock (&priv->updates_lock);
+ g_rec_mutex_unlock (&priv->updates_lock);
}
static void
@@ -1039,7 +1039,7 @@ mapi_store_finalize (GObject *object)
if (priv->container_hash != NULL)
g_hash_table_destroy (priv->container_hash);
- g_static_rec_mutex_free (&priv->updates_lock);
+ g_rec_mutex_clear (&priv->updates_lock);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (camel_mapi_store_parent_class)->finalize (object);
@@ -2033,7 +2033,7 @@ camel_mapi_store_init (CamelMapiStore *mapi_store)
{
mapi_store->priv = G_TYPE_INSTANCE_GET_PRIVATE (mapi_store, CAMEL_TYPE_MAPI_STORE, CamelMapiStorePrivate);
- g_static_rec_mutex_init (&mapi_store->priv->updates_lock);
+ g_rec_mutex_init (&mapi_store->priv->updates_lock);
mapi_store->priv->updates_cancellable = NULL;
mapi_store->priv->update_folder_names = NULL;
mapi_store->priv->update_folder_id = 0;
@@ -2289,6 +2289,7 @@ run_update_thread (CamelMapiStore *mapi_store,
GSList *foldernames)
{
struct ScheduleUpdateData *sud;
+ GThread *thread;
g_return_if_fail (mapi_store != NULL);
g_return_if_fail (cancellable != NULL);
@@ -2298,7 +2299,8 @@ run_update_thread (CamelMapiStore *mapi_store,
sud->cancellable = g_object_ref (cancellable);
sud->foldernames = foldernames;
- g_thread_create (camel_mapi_folder_update_thread, sud, FALSE, NULL);
+ thread = g_thread_new (NULL, camel_mapi_folder_update_thread, sud);
+ g_thread_unref (thread);
}
static gboolean
@@ -2315,9 +2317,9 @@ folder_update_cb (gpointer user_data)
g_return_val_if_fail (sud->mapi_store != NULL, FALSE);
g_return_val_if_fail (sud->mapi_store->priv != NULL, FALSE);
- g_static_rec_mutex_lock (&sud->mapi_store->priv->updates_lock);
+ g_rec_mutex_lock (&sud->mapi_store->priv->updates_lock);
if (sud->expected_id != sud->mapi_store->priv->update_folder_id) {
- g_static_rec_mutex_unlock (&sud->mapi_store->priv->updates_lock);
+ g_rec_mutex_unlock (&sud->mapi_store->priv->updates_lock);
return FALSE;
}
@@ -2330,7 +2332,7 @@ folder_update_cb (gpointer user_data)
else
g_slist_free_full (foldernames, g_free);
- g_static_rec_mutex_unlock (&sud->mapi_store->priv->updates_lock);
+ g_rec_mutex_unlock (&sud->mapi_store->priv->updates_lock);
return FALSE;
}
@@ -2369,10 +2371,10 @@ schedule_folder_update (CamelMapiStore *mapi_store, mapi_id_t fid)
if (!foldername)
return;
- g_static_rec_mutex_lock (&mapi_store->priv->updates_lock);
+ g_rec_mutex_lock (&mapi_store->priv->updates_lock);
if (!mapi_store->priv->updates_cancellable ||
g_slist_find_custom (mapi_store->priv->update_folder_names, foldername, (GCompareFunc) g_ascii_strcasecmp) != 0) {
- g_static_rec_mutex_unlock (&mapi_store->priv->updates_lock);
+ g_rec_mutex_unlock (&mapi_store->priv->updates_lock);
return;
}
@@ -2386,7 +2388,7 @@ schedule_folder_update (CamelMapiStore *mapi_store, mapi_id_t fid)
mapi_store->priv->update_folder_id = g_timeout_add_seconds_full (G_PRIORITY_LOW, 5, folder_update_cb, sud, free_schedule_update_data);
sud->expected_id = mapi_store->priv->update_folder_id;
- g_static_rec_mutex_unlock (&mapi_store->priv->updates_lock);
+ g_rec_mutex_unlock (&mapi_store->priv->updates_lock);
}
static gboolean
@@ -2402,9 +2404,9 @@ folder_list_update_cb (gpointer user_data)
g_return_val_if_fail (sud->mapi_store != NULL, FALSE);
g_return_val_if_fail (sud->mapi_store->priv != NULL, FALSE);
- g_static_rec_mutex_lock (&sud->mapi_store->priv->updates_lock);
+ g_rec_mutex_lock (&sud->mapi_store->priv->updates_lock);
if (sud->expected_id != sud->mapi_store->priv->update_folder_list_id) {
- g_static_rec_mutex_unlock (&sud->mapi_store->priv->updates_lock);
+ g_rec_mutex_unlock (&sud->mapi_store->priv->updates_lock);
return FALSE;
}
@@ -2414,7 +2416,7 @@ folder_list_update_cb (gpointer user_data)
if (!g_cancellable_is_cancelled (sud->cancellable))
run_update_thread (sud->mapi_store, sud->cancellable, NULL);
- g_static_rec_mutex_unlock (&sud->mapi_store->priv->updates_lock);
+ g_rec_mutex_unlock (&sud->mapi_store->priv->updates_lock);
return FALSE;
}
@@ -2427,9 +2429,9 @@ schedule_folder_list_update (CamelMapiStore *mapi_store)
g_return_if_fail (mapi_store != NULL);
g_return_if_fail (mapi_store->priv != NULL);
- g_static_rec_mutex_lock (&mapi_store->priv->updates_lock);
+ g_rec_mutex_lock (&mapi_store->priv->updates_lock);
if (!mapi_store->priv->updates_cancellable) {
- g_static_rec_mutex_unlock (&mapi_store->priv->updates_lock);
+ g_rec_mutex_unlock (&mapi_store->priv->updates_lock);
return;
}
@@ -2442,7 +2444,7 @@ schedule_folder_list_update (CamelMapiStore *mapi_store)
mapi_store->priv->update_folder_list_id = g_timeout_add_seconds_full (G_PRIORITY_LOW, 5, folder_list_update_cb, sud, free_schedule_update_data);
sud->expected_id = mapi_store->priv->update_folder_list_id;
- g_static_rec_mutex_unlock (&mapi_store->priv->updates_lock);
+ g_rec_mutex_unlock (&mapi_store->priv->updates_lock);
}
static void
diff --git a/src/configuration/e-mapi-config-utils.c b/src/configuration/e-mapi-config-utils.c
index f9a1e61..22a5b4b 100644
--- a/src/configuration/e-mapi-config-utils.c
+++ b/src/configuration/e-mapi-config-utils.c
@@ -202,20 +202,25 @@ e_mapi_config_utils_run_in_thread_with_feedback_general (GtkWindow *parent,
g_signal_connect (dialog, "response", G_CALLBACK (run_with_feedback_response_cb), rfd);
if (run_modal) {
+ GThread *thread;
GCancellable *cancellable;
cancellable = g_object_ref (rfd->cancellable);
- g_return_if_fail (g_thread_create (run_with_feedback_thread, rfd, FALSE, NULL));
+ thread = g_thread_new (NULL, run_with_feedback_thread, rfd);
+ g_thread_unref (thread);
gtk_dialog_run (GTK_DIALOG (dialog));
g_cancellable_cancel (cancellable);
g_object_unref (cancellable);
} else {
+ GThread *thread;
+
gtk_widget_show (dialog);
- g_return_if_fail (g_thread_create (run_with_feedback_thread, rfd, FALSE, NULL));
+ thread = g_thread_new (NULL, run_with_feedback_thread, rfd);
+ g_thread_unref (thread);
}
}
@@ -545,6 +550,7 @@ e_mapi_config_utils_run_folder_size_dialog (ESourceRegistry *registry,
GtkWidget *spinner, *alignment, *dialog;
GtkWidget *spinner_label;
GCancellable *cancellable;
+ GThread *thread;
FolderSizeDialogData *fsd;
g_return_if_fail (mapi_settings != NULL);
@@ -587,7 +593,8 @@ e_mapi_config_utils_run_folder_size_dialog (ESourceRegistry *registry,
fsd->mapi_settings = g_object_ref (mapi_settings);
fsd->cancellable = g_object_ref (cancellable);
- g_return_if_fail (g_thread_create (mapi_settings_get_folder_size_thread, fsd, FALSE, NULL));
+ thread = g_thread_new (NULL, mapi_settings_get_folder_size_thread, fsd);
+ g_thread_unref (thread);
/* Start the dialog */
gtk_dialog_run (GTK_DIALOG (dialog));
diff --git a/src/configuration/e-mapi-search-gal-user.c b/src/configuration/e-mapi-search-gal-user.c
index c09007b..a2e3fd3 100644
--- a/src/configuration/e-mapi-search-gal-user.c
+++ b/src/configuration/e-mapi-search-gal-user.c
@@ -454,6 +454,7 @@ schedule_search_cb (gpointer user_data)
if (!g_cancellable_is_cancelled (sid->cancellable)) {
struct EMapiSearchGalUserData *pgu;
+ GThread *thread;
GError *error = NULL;
pgu = g_object_get_data (sid->dialog, E_MAPI_SEARCH_DLG_DATA);
@@ -464,8 +465,10 @@ schedule_search_cb (gpointer user_data)
sid->conn = g_object_ref (pgu->conn);
sid->search_text = g_strdup (pgu->search_text);
- if (g_thread_create (search_gal_thread, sid, FALSE, &error)) {
+ thread = g_thread_try_new (NULL, search_gal_thread, sid, &error);
+ if (thread) {
sid = NULL;
+ g_thread_unref (thread);
} else {
g_object_unref (sid->conn);
g_warning ("%s: Failed to create search thread: %s", G_STRFUNC, error ? error->message : "Unknown error");
diff --git a/src/libexchangemapi/camel-mapi-settings.c b/src/libexchangemapi/camel-mapi-settings.c
index 6257117..6acc736 100644
--- a/src/libexchangemapi/camel-mapi-settings.c
+++ b/src/libexchangemapi/camel-mapi-settings.c
@@ -23,7 +23,7 @@
((obj), CAMEL_TYPE_MAPI_SETTINGS, CamelMapiSettingsPrivate))
struct _CamelMapiSettingsPrivate {
- GMutex *property_lock;
+ GMutex property_lock;
gboolean check_all;
gboolean filter_junk;
@@ -259,7 +259,7 @@ mapi_settings_finalize (GObject *object)
priv = CAMEL_MAPI_SETTINGS_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->domain);
g_free (priv->profile);
@@ -412,7 +412,7 @@ static void
camel_mapi_settings_init (CamelMapiSettings *settings)
{
settings->priv = CAMEL_MAPI_SETTINGS_GET_PRIVATE (settings);
- settings->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&settings->priv->property_lock);
}
gboolean
@@ -453,12 +453,12 @@ camel_mapi_settings_dup_domain (CamelMapiSettings *settings)
g_return_val_if_fail (CAMEL_IS_MAPI_SETTINGS (settings), NULL);
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
protected = camel_mapi_settings_get_domain (settings);
duplicate = g_strdup (protected);
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
return duplicate;
}
@@ -473,17 +473,17 @@ camel_mapi_settings_set_domain (CamelMapiSettings *settings,
if (domain == NULL)
domain = "";
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
if (g_strcmp0 (settings->priv->domain, domain) == 0) {
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
return;
}
g_free (settings->priv->domain);
settings->priv->domain = g_strdup (domain);
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
g_object_notify (G_OBJECT (settings), "domain");
}
@@ -570,12 +570,12 @@ camel_mapi_settings_dup_profile (CamelMapiSettings *settings)
g_return_val_if_fail (CAMEL_IS_MAPI_SETTINGS (settings), NULL);
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
protected = camel_mapi_settings_get_profile (settings);
duplicate = g_strdup (protected);
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
return duplicate;
}
@@ -586,17 +586,17 @@ camel_mapi_settings_set_profile (CamelMapiSettings *settings,
{
g_return_if_fail (CAMEL_IS_MAPI_SETTINGS (settings));
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
if (g_strcmp0 (settings->priv->profile, profile) == 0) {
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
return;
}
g_free (settings->priv->profile);
settings->priv->profile = g_strdup (profile);
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
g_object_notify (G_OBJECT (settings), "profile");
}
@@ -617,12 +617,12 @@ camel_mapi_settings_dup_realm (CamelMapiSettings *settings)
g_return_val_if_fail (CAMEL_IS_MAPI_SETTINGS (settings), NULL);
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
protected = camel_mapi_settings_get_realm (settings);
duplicate = g_strdup (protected);
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
return duplicate;
}
@@ -637,17 +637,17 @@ camel_mapi_settings_set_realm (CamelMapiSettings *settings,
if (realm == NULL)
realm = "";
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
if (g_strcmp0 (settings->priv->realm, realm) == 0) {
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
return;
}
g_free (settings->priv->realm);
settings->priv->realm = g_strdup (realm);
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
g_object_notify (G_OBJECT (settings), "realm");
}
diff --git a/src/libexchangemapi/e-mapi-cal-tz-utils.c b/src/libexchangemapi/e-mapi-cal-tz-utils.c
index af091eb..0e068ba 100644
--- a/src/libexchangemapi/e-mapi-cal-tz-utils.c
+++ b/src/libexchangemapi/e-mapi-cal-tz-utils.c
@@ -31,7 +31,7 @@
#define MAPPING_SEPARATOR "~~~"
-static GStaticRecMutex mutex = G_STATIC_REC_MUTEX_INIT;
+static GRecMutex mutex;
static GHashTable *mapi_to_ical = NULL;
static GHashTable *ical_to_mapi = NULL;
@@ -43,9 +43,9 @@ e_mapi_cal_tz_util_get_mapi_equivalent (const gchar *ical_tz_location)
g_return_val_if_fail ((ical_tz_location && *ical_tz_location), NULL);
- g_static_rec_mutex_lock(&mutex);
+ g_rec_mutex_lock(&mutex);
if (!e_mapi_cal_tz_util_populate()) {
- g_static_rec_mutex_unlock(&mutex);
+ g_rec_mutex_unlock(&mutex);
return NULL;
}
@@ -53,7 +53,7 @@ e_mapi_cal_tz_util_get_mapi_equivalent (const gchar *ical_tz_location)
retval = g_hash_table_lookup (ical_to_mapi, ical_tz_location);
- g_static_rec_mutex_unlock(&mutex);
+ g_rec_mutex_unlock(&mutex);
return retval;
}
@@ -65,9 +65,9 @@ e_mapi_cal_tz_util_get_ical_equivalent (const gchar *mapi_tz_location)
g_return_val_if_fail ((mapi_tz_location && *mapi_tz_location), NULL);
- g_static_rec_mutex_lock(&mutex);
+ g_rec_mutex_lock(&mutex);
if (!e_mapi_cal_tz_util_populate()) {
- g_static_rec_mutex_unlock(&mutex);
+ g_rec_mutex_unlock(&mutex);
return NULL;
}
@@ -75,7 +75,7 @@ e_mapi_cal_tz_util_get_ical_equivalent (const gchar *mapi_tz_location)
retval = g_hash_table_lookup (mapi_to_ical, mapi_tz_location);
- g_static_rec_mutex_unlock(&mutex);
+ g_rec_mutex_unlock(&mutex);
return retval;
}
@@ -137,9 +137,9 @@ e_mapi_cal_tz_util_ical_from_zone_struct (const guint8 *lpb,
memcpy (&stdBias, lpb, 4); lpb += 4;
memcpy (&dstBias, lpb, 4); lpb += 4;
- g_static_rec_mutex_lock (&mutex);
+ g_rec_mutex_lock (&mutex);
if (!e_mapi_cal_tz_util_populate ()) {
- g_static_rec_mutex_unlock (&mutex);
+ g_rec_mutex_unlock (&mutex);
return NULL;
}
@@ -169,7 +169,7 @@ e_mapi_cal_tz_util_ical_from_zone_struct (const guint8 *lpb,
res = location;
}
- g_static_rec_mutex_unlock (&mutex);
+ g_rec_mutex_unlock (&mutex);
return res;
}
@@ -177,9 +177,9 @@ e_mapi_cal_tz_util_ical_from_zone_struct (const guint8 *lpb,
void
e_mapi_cal_tz_util_destroy (void)
{
- g_static_rec_mutex_lock(&mutex);
+ g_rec_mutex_lock(&mutex);
if (!(mapi_to_ical && ical_to_mapi)) {
- g_static_rec_mutex_unlock(&mutex);
+ g_rec_mutex_unlock(&mutex);
return;
}
@@ -190,7 +190,7 @@ e_mapi_cal_tz_util_destroy (void)
mapi_to_ical = NULL;
ical_to_mapi = NULL;
- g_static_rec_mutex_unlock(&mutex);
+ g_rec_mutex_unlock(&mutex);
}
static void
@@ -218,9 +218,9 @@ e_mapi_cal_tz_util_populate (void)
gchar *mtoi_fn = NULL, *itom_fn = NULL;
GMappedFile *mtoi_mf = NULL, *itom_mf = NULL;
- g_static_rec_mutex_lock(&mutex);
+ g_rec_mutex_lock(&mutex);
if (mapi_to_ical && ical_to_mapi) {
- g_static_rec_mutex_unlock(&mutex);
+ g_rec_mutex_unlock(&mutex);
return TRUE;
}
@@ -249,7 +249,7 @@ e_mapi_cal_tz_util_populate (void)
g_mapped_file_free (itom_mf);
#endif
- g_static_rec_mutex_unlock(&mutex);
+ g_rec_mutex_unlock(&mutex);
return FALSE;
}
@@ -280,7 +280,7 @@ e_mapi_cal_tz_util_populate (void)
g_mapped_file_free (itom_mf);
#endif
- g_static_rec_mutex_unlock(&mutex);
+ g_rec_mutex_unlock(&mutex);
return FALSE;
}
@@ -294,7 +294,7 @@ e_mapi_cal_tz_util_populate (void)
d(e_mapi_cal_tz_util_dump ());
- g_static_rec_mutex_unlock(&mutex);
+ g_rec_mutex_unlock(&mutex);
return TRUE;
}
@@ -340,12 +340,12 @@ e_mapi_cal_tz_util_dump (void)
guint i;
GList *keys, *values, *l, *m;
- g_static_rec_mutex_lock(&mutex);
+ g_rec_mutex_lock(&mutex);
e_mapi_cal_tz_util_dump_ical_tzs ();
if (!(mapi_to_ical && ical_to_mapi)) {
- g_static_rec_mutex_unlock(&mutex);
+ g_rec_mutex_unlock(&mutex);
return;
}
@@ -377,7 +377,7 @@ e_mapi_cal_tz_util_dump (void)
g_list_free (keys);
g_list_free (values);
- g_static_rec_mutex_unlock(&mutex);
+ g_rec_mutex_unlock(&mutex);
}
#define TZDEFINITION_FLAG_VALID_GUID 0x0001 // the guid is valid
diff --git a/src/libexchangemapi/e-mapi-connection.c b/src/libexchangemapi/e-mapi-connection.c
index 9d15456..7637c52 100644
--- a/src/libexchangemapi/e-mapi-connection.c
+++ b/src/libexchangemapi/e-mapi-connection.c
@@ -202,7 +202,7 @@ struct _EMapiConnectionPrivate {
GHashTable *foreign_stores; /* username (gchar *) => msg_store (mapi_object_t *); opened foreign stores */
GSList *folders; /* list of ExchangeMapiFolder pointers */
- GStaticRecMutex folders_lock; /* lock for 'folders' variable */
+ GRecMutex folders_lock; /* lock for 'folders' variable */
GHashTable *named_ids; /* cache of named ids; key is a folder ID, value is a hash table
of named_id to prop_id in that respective folder */
@@ -291,11 +291,11 @@ disconnect (EMapiConnectionPrivate *priv,
if (!priv->session)
return;
- g_static_rec_mutex_lock (&priv->folders_lock);
+ g_rec_mutex_lock (&priv->folders_lock);
if (priv->folders)
e_mapi_folder_free_list (priv->folders);
priv->folders = NULL;
- g_static_rec_mutex_unlock (&priv->folders_lock);
+ g_rec_mutex_unlock (&priv->folders_lock);
if (priv->has_public_store)
mapi_object_release (&priv->public_store);
@@ -429,7 +429,7 @@ e_mapi_connection_finalize (GObject *object)
UNLOCK ();
e_mapi_cancellable_rec_mutex_clear (&priv->session_lock);
- g_static_rec_mutex_free (&priv->folders_lock);
+ g_rec_mutex_clear (&priv->folders_lock);
e_mapi_utils_destroy_mapi_context (priv->mapi_ctx);
priv->mapi_ctx = NULL;
@@ -477,7 +477,7 @@ e_mapi_connection_init (EMapiConnection *conn)
g_return_if_fail (conn->priv != NULL);
e_mapi_cancellable_rec_mutex_init (&conn->priv->session_lock);
- g_static_rec_mutex_init (&conn->priv->folders_lock);
+ g_rec_mutex_init (&conn->priv->folders_lock);
conn->priv->session = NULL;
conn->priv->profile = NULL;
@@ -5083,10 +5083,10 @@ e_mapi_connection_remove_folder (EMapiConnection *conn,
mapi_object_release (&obj_parent);
if (folder) {
- g_static_rec_mutex_lock (&priv->folders_lock);
+ g_rec_mutex_lock (&priv->folders_lock);
priv->folders = g_slist_remove (priv->folders, folder);
e_mapi_folder_free (folder);
- g_static_rec_mutex_unlock (&priv->folders_lock);
+ g_rec_mutex_unlock (&priv->folders_lock);
}
UNLOCK ();
@@ -6188,7 +6188,7 @@ e_mapi_connection_peek_folders_list (EMapiConnection *conn)
CHECK_CORRECT_CONN_AND_GET_PRIV (conn, NULL);
e_return_val_mapi_error_if_fail (priv->session != NULL, MAPI_E_INVALID_PARAMETER, NULL);
- g_static_rec_mutex_lock (&priv->folders_lock);
+ g_rec_mutex_lock (&priv->folders_lock);
if (!priv->folders) {
LOCK (NULL, NULL, NULL);
@@ -6196,7 +6196,7 @@ e_mapi_connection_peek_folders_list (EMapiConnection *conn)
UNLOCK ();
}
- g_static_rec_mutex_unlock (&priv->folders_lock);
+ g_rec_mutex_unlock (&priv->folders_lock);
return priv->folders;
}
@@ -6544,7 +6544,7 @@ e_mapi_connection_enable_notifications (EMapiConnection *conn,
if (priv->notification_thread) {
e_flag_set (priv->notification_flag);
} else {
- priv->notification_thread = g_thread_create (e_mapi_connection_notification_thread, conn, TRUE, NULL);
+ priv->notification_thread = g_thread_new (NULL, e_mapi_connection_notification_thread, conn);
}
} else {
make_mapi_error (perror, "Subscribe", ms);
diff --git a/src/libexchangemapi/e-mapi-operation-queue.c b/src/libexchangemapi/e-mapi-operation-queue.c
index 328b379..86b504d 100644
--- a/src/libexchangemapi/e-mapi-operation-queue.c
+++ b/src/libexchangemapi/e-mapi-operation-queue.c
@@ -27,8 +27,8 @@
static void thread_func_cb (gpointer data, gpointer pqueue);
-#define LOCK() g_mutex_lock (priv->lock)
-#define UNLOCK() g_mutex_unlock (priv->lock)
+#define LOCK() g_mutex_lock (&priv->lock)
+#define UNLOCK() g_mutex_unlock (&priv->lock)
/* GObject foo - begin */
@@ -36,7 +36,7 @@ G_DEFINE_TYPE (EMapiOperationQueue, e_mapi_operation_queue, G_TYPE_OBJECT)
struct _EMapiOperationQueuePrivate
{
- GMutex *lock;
+ GMutex lock;
GThreadPool *pool;
EMapiOperationQueueFunc worker_cb;
gpointer user_data;
@@ -67,7 +67,7 @@ e_mapi_operation_queue_dispose (GObject *object)
UNLOCK ();
- g_mutex_free (priv->lock);
+ g_mutex_clear (&priv->lock);
}
if (G_OBJECT_CLASS (e_mapi_operation_queue_parent_class)->dispose)
@@ -97,7 +97,7 @@ e_mapi_operation_queue_init (EMapiOperationQueue *queue)
priv = queue->priv;
g_return_if_fail (priv != NULL);
- priv->lock = g_mutex_new ();
+ g_mutex_init (&priv->lock);
priv->pool = g_thread_pool_new (thread_func_cb, queue, 1, FALSE, NULL);
priv->worker_cb = NULL;
priv->user_data = NULL;
diff --git a/src/libexchangemapi/e-mapi-utils.c b/src/libexchangemapi/e-mapi-utils.c
index 9e5eace..a876df1 100644
--- a/src/libexchangemapi/e-mapi-utils.c
+++ b/src/libexchangemapi/e-mapi-utils.c
@@ -1372,6 +1372,7 @@ unref_object_in_thread (gpointer ptr)
void
e_mapi_utils_unref_in_thread (GObject *object)
{
+ GThread *thread;
GError *error = NULL;
if (!object)
@@ -1379,7 +1380,10 @@ e_mapi_utils_unref_in_thread (GObject *object)
g_return_if_fail (G_IS_OBJECT (object));
- if (!g_thread_create (unref_object_in_thread, object, FALSE, &error)) {
+ thread = g_thread_try_new (NULL, unref_object_in_thread, object, &error);
+ if (thread) {
+ g_thread_unref (thread);
+ } else {
g_warning ("%s: Failed to run thread: %s", G_STRFUNC, error ? error->message : "Unknown error");
g_object_unref (object);
}
diff --git a/src/libexchangemapi/e-source-mapi-folder.c b/src/libexchangemapi/e-source-mapi-folder.c
index 06d2e7b..292e927 100644
--- a/src/libexchangemapi/e-source-mapi-folder.c
+++ b/src/libexchangemapi/e-source-mapi-folder.c
@@ -23,7 +23,7 @@
((obj), E_TYPE_SOURCE_MAPI_FOLDER, ESourceMapiFolderPrivate))
struct _ESourceMapiFolderPrivate {
- GMutex *property_lock;
+ GMutex property_lock;
guint64 fid;
guint64 parent_fid;
gboolean is_public;
@@ -169,7 +169,7 @@ source_mapi_folder_finalize (GObject *object)
priv = E_SOURCE_MAPI_FOLDER_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->foreign_username);
@@ -287,7 +287,7 @@ static void
e_source_mapi_folder_init (ESourceMapiFolder *extension)
{
extension->priv = E_SOURCE_MAPI_FOLDER_GET_PRIVATE (extension);
- extension->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&extension->priv->property_lock);
extension->priv->fid = 0;
extension->priv->parent_fid = 0;
@@ -454,11 +454,11 @@ e_source_mapi_folder_dup_foreign_username (ESourceMapiFolder *extension)
g_return_val_if_fail (E_IS_SOURCE_MAPI_FOLDER (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
duplicate = g_strdup (e_source_mapi_folder_get_foreign_username (extension));
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
@@ -469,20 +469,20 @@ e_source_mapi_folder_set_foreign_username (ESourceMapiFolder *extension,
{
g_return_if_fail (E_IS_SOURCE_MAPI_FOLDER (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (foreign_username && !*foreign_username)
foreign_username = NULL;
if (g_strcmp0 (extension->priv->foreign_username, foreign_username) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->foreign_username);
extension->priv->foreign_username = g_strdup (foreign_username);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "foreign-username");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]