[evolution-ews] Fix crash on addressbook close
- From: David Woodhouse <dwmw2 src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews] Fix crash on addressbook close
- Date: Fri, 17 May 2013 13:50:40 +0000 (UTC)
commit a56a32e1044a7932e91425a0398a0ae00c9398a5
Author: David Woodhouse <David Woodhouse intel com>
Date: Fri May 17 14:47:27 2013 +0100
Fix crash on addressbook close
In e_book_backend_ews_dispose() we cancel priv->cancellable and then
immediately free it along with a bunch of other stuff, and *then* wait
for the update thread to complete.
The update thread then crashes the next time it checks if the (now-freed)
cancellable is cancelled.
We should first cancel it, *then* wait for the thread, and then free
everything else. In fact I'm not entirely sure we *should* be freeing
everything else here; isn't that supposed to be done in the finalize()
method? But I'll leave it as-is for now...
src/addressbook/e-book-backend-ews.c | 36 +++++++++++++++++----------------
1 files changed, 19 insertions(+), 17 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-ews.c b/src/addressbook/e-book-backend-ews.c
index afe9d0c..1d57e8a 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -3525,8 +3525,26 @@ e_book_backend_ews_dispose (GObject *object)
bews = E_BOOK_BACKEND_EWS (object);
priv = bews->priv;
- if (priv->cancellable) {
+ if (priv->cancellable)
g_cancellable_cancel (priv->cancellable);
+
+ if (priv->dlock) {
+ g_mutex_lock (&priv->dlock->mutex);
+ priv->dlock->exit = TRUE;
+ g_mutex_unlock (&priv->dlock->mutex);
+
+ g_cond_signal (&priv->dlock->cond);
+
+ if (priv->dthread)
+ g_thread_join (priv->dthread);
+
+ g_mutex_clear (&priv->dlock->mutex);
+ g_cond_clear (&priv->dlock->cond);
+ g_free (priv->dlock);
+ priv->dthread = NULL;
+ }
+
+ if (priv->cancellable) {
g_object_unref (priv->cancellable);
priv->cancellable = NULL;
}
@@ -3548,22 +3566,6 @@ e_book_backend_ews_dispose (GObject *object)
g_free (priv->attachment_dir);
priv->attachment_dir = NULL;
- if (priv->dlock) {
- g_mutex_lock (&priv->dlock->mutex);
- priv->dlock->exit = TRUE;
- g_mutex_unlock (&priv->dlock->mutex);
-
- g_cond_signal (&priv->dlock->cond);
-
- if (priv->dthread)
- g_thread_join (priv->dthread);
-
- g_mutex_clear (&priv->dlock->mutex);
- g_cond_clear (&priv->dlock->cond);
- g_free (priv->dlock);
- priv->dthread = NULL;
- }
-
if (priv->summary) {
g_object_unref (priv->summary);
priv->summary = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]