高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】a problem about the release of oddbentityptr
a problem about the release of oddbentityptr
a problem about the release of oddbentityptr
hello:
i have a problem about the release of oddbentityptr.
int dim_objectcreateentity(
oddbdatabase* pdbcurr,
oddbentityptr pobj,
oddbobjectid& objid)
{
.....
objid=pblocktablerecord->appendoddbentity(pobj);
......
return 0;
}
when it return from the function above, the pobj->numrefs() = 2, i don't know why it hadn't been release after return();
if i cut off "objid=pblocktablerecord->appendoddbentity(pobj);", the pobj->numrefs() = 1 after it return.
i use this function like this
sunpousen *sunpousen = new sunpousen() ;
status=dim_objectcreateentity(pdb,sunpousen->obj,objid);
is there anything wrong with it ?
i puzzled...
thanks.
it is normal. database resident object has 2 references when it is open. object id holds one reference.
vladimir
but after it return from the function , it can't been saved to .dwg, and the error message is "ewasopenforwrite".
you should not keep smart pointer in your class.
vladimir
thanks.
the problem has been solved.
the method of adding ptr to class is bad.
|