GNOME Bugzilla – Bug 655499
Don't crash when getting contacts before backend is opened
Last modified: 2013-09-14 16:53:53 UTC
Programmers might sometimes forget to call open() (or open_sync): client = EBook.BookClient.new_system() query_string = "(contains \"x-evolution-any-field\" \"\")" ret = client.get_contacts_sync(query_string, None) which causes e-addressbook-factory to crash with: (e-addressbook-factory:13305): libedata-book-CRITICAL **: e_book_backend_summary_is_summary_query: assertion `summary != NULL' failed Program received signal SIGSEGV, Segmentation fault.
+ Trace 227923
Thread 140737315383040 (LWP 13309)
because db is null. So we should check if the addressbook is open and return an error if it isn't.
Thanks for the bug report, I agree. The only question is whether control this in an upper level, like EBook/CalBackend, or in each descendant. The first seems to me better.
Created attachment 192982 [details] [review] eds patch for evolution-data-server; This covers both, fix in file addressbook backend and checking in backend base class whether the backend is opened or not, returning an error when it is not opened. The later for both calendar and address book. It worked fine with my tests, but please let me know if you find any regression with this change. Thanks in advance.
Created commit 68646a9 in eds master (3.1.5+)