* The object memory management depends slightly on whether an object type is created initially owned or not.
* In order not to be lost and make memory fault or leaks, consider the following rules:
*
* When an object is of type initially unowned:
* * call belle_sip_object_ref() on it only if you need a pointer to this object to be used outside the scope of the current function.
* * call belle_sip_object_unref() on it only if you previously called belle_sip_object_ref().
*
* When an object is of type initially owned:
* * you can safely store its pointer.
* * use belle_sip_object_unref() when you no longer need it.
*
* Also, keep in mind that most objects of belle-sip are initially unowned, especially
* * all objects who are usually required to be used inside another object (for example: an URI is part of a from header, a contact header is part of a message)
* * all objects whose lifecyle is maintained by the stack: transactions, dialogs.
*
* On the contrary, top level objects whose lifecyle belongs only to the application are initially owned:
* Internally, belle-sip objects containing pointers to other objects must take a reference count on the other objects they hold; and leave this reference
* when they no longer need it. This rule must be strictly followed by developers doing things inside belle-sip.
**/
typedefstruct_belle_sip_objectbelle_sip_object_t;
...
...
@@ -120,6 +150,7 @@ int belle_sip_object_is_unowed(const belle_sip_object_t *obj);
/**
* Increments reference counter, which prevents the object from being destroyed.
* If the object is initially unowed, this acquires the first reference.