![]() |
【转帖】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. |
所有的时间均为北京时间。 现在的时间是 12:23 PM. |