Commit 51906fb4 authored by Ronan's avatar Ronan
Browse files

fix(object): do not call on_first_ref in object_new

parent 99832d3a
...@@ -100,8 +100,7 @@ belle_sip_object_t * _belle_sip_object_new(size_t objsize, belle_sip_object_vptr ...@@ -100,8 +100,7 @@ belle_sip_object_t * _belle_sip_object_new(size_t objsize, belle_sip_object_vptr
if (obj->ref == 0) { if (obj->ref == 0) {
belle_sip_object_pool_t *pool=belle_sip_object_pool_get_current(); belle_sip_object_pool_t *pool=belle_sip_object_pool_get_current();
if (pool) belle_sip_object_pool_add(pool,obj); if (pool) belle_sip_object_pool_add(pool,obj);
} else if (obj->ref == 1 && obj->vptr->on_first_ref) }
obj->vptr->on_first_ref(obj);
add_new_object(obj); add_new_object(obj);
return obj; return obj;
...@@ -117,9 +116,9 @@ belle_sip_object_t * belle_sip_object_ref(void *obj){ ...@@ -117,9 +116,9 @@ belle_sip_object_t * belle_sip_object_ref(void *obj){
belle_sip_object_pool_remove(o->pool,obj); belle_sip_object_pool_remove(o->pool,obj);
} }
o->ref++; if (o->vptr->on_first_ref && (o->ref == 0 || (!o->vptr->initially_unowned && o->ref == 1)))
if (o->vptr->on_first_ref && o->ref == 1)
o->vptr->on_first_ref(o); o->vptr->on_first_ref(o);
o->ref++;
return obj; return obj;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment