[evolution-data-server] Avoid crash in e_book_backend_file_load_revision()
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Avoid crash in e_book_backend_file_load_revision()
- Date: Fri, 25 Jan 2013 14:06:49 +0000 (UTC)
commit e4ad37323d94bd35c77f8238314d2c2b9f4442c8
Author: Milan Crha <mcrha redhat com>
Date: Fri Jan 25 15:03:11 2013 +0100
Avoid crash in e_book_backend_file_load_revision()
There could happen a crash in e_book_backend_file_load_revision()
due to NULL 'error' when an application did a quick open/close
operations, in which case a backend was reused, with already set
priv::revision, and the call failed on a runtime constraint, but
didn't set the 'error', which led to the crash.
addressbook/backends/file/e-book-backend-file.c | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/addressbook/backends/file/e-book-backend-file.c b/addressbook/backends/file/e-book-backend-file.c
index b86384c..a0a35bd 100644
--- a/addressbook/backends/file/e-book-backend-file.c
+++ b/addressbook/backends/file/e-book-backend-file.c
@@ -652,8 +652,8 @@ e_book_backend_file_load_revision (EBookBackendFile *bf)
&error)) {
g_warning (
G_STRLOC ": Error loading database revision: %s",
- error->message);
- g_error_free (error);
+ error ? error->message : "Unknown error");
+ g_clear_error (&error);
} else if (bf->priv->revision == NULL) {
e_book_backend_file_bump_revision (bf);
}
@@ -1455,17 +1455,18 @@ e_book_backend_file_open (EBookBackendSync *backend,
return;
bf->priv->photo_dirname = dirname;
- e_book_backend_file_load_revision (bf);
+ g_rec_mutex_lock (&bf->priv->revision_mutex);
+ if (!bf->priv->revision) {
+ e_book_backend_file_load_revision (bf);
+ e_book_backend_notify_property_changed (E_BOOK_BACKEND (backend),
+ BOOK_BACKEND_PROPERTY_REVISION,
+ bf->priv->revision);
+ g_rec_mutex_unlock (&bf->priv->revision_mutex);
+ }
e_book_backend_notify_online (E_BOOK_BACKEND (backend), TRUE);
e_book_backend_notify_readonly (E_BOOK_BACKEND (backend), FALSE);
e_book_backend_notify_opened (E_BOOK_BACKEND (backend), NULL /* Success */);
-
- g_rec_mutex_lock (&bf->priv->revision_mutex);
- e_book_backend_notify_property_changed (E_BOOK_BACKEND (backend),
- BOOK_BACKEND_PROPERTY_REVISION,
- bf->priv->revision);
- g_rec_mutex_unlock (&bf->priv->revision_mutex);
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]