Re: [Evolution-hackers] Camel unreferencing question



On Fri, 2006-08-25 at 12:10 +0200, Philip Van Hoof wrote:
> Camel hackers,
> 
> It's not clear from the gtk-doc API documentation* whether or not you
> must unreference a store after getting it using camel_session_get_store
> 
> *) http://pvanhoof.be/files/libcamel-api/html/CamelSession.html

The source is:

CamelService *
camel_session_get_service_connected (CamelSession *session,
                                     const char *url_string,
                                     CamelProviderType type,
                                     CamelException *ex)
{
        CamelService *svc;

        svc = camel_session_get_service (session, url_string, type, ex);
        if (svc == NULL)
                return NULL;

        if (svc->status != CAMEL_SERVICE_CONNECTED) {
                if (camel_service_connect (svc, ex) == FALSE) {
                        camel_object_unref (svc);
                        return NULL;
                }
        }

        return svc;
}
#define camel_session_get_store(session, url_string, ex) \
        ((CamelStore *) camel_session_get_service_connected (session, url_string, CAMEL_PROVIDER_STORE, ex))

The comment for camel_session_get_service() says that the reference
count for the service is incremented for each retrieval. This seems to
conclusively prove that you should indeed unref the store after you are
done with it.

HTH,
  jules





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]