Why does this code segfault?Code: Select all
var op = new RAddObjectsOperation(); op.addObject(entity); di.applyOperation(op); ... op = new RAddObjectsOperation(); op.deleteObject(entity); di.applyOperation(op);
Deleting entity segfaults
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Deleting entity segfaults
From a QCAD user:
Re: Deleting entity segfaults
Entity pointers should not be used more than once in an operation. If you need to apply an operation on the same entity, you need to retrieve a new pointer first:
Code: Select all
var op = new RAddObjectsOperation();
op.addObject(entity);
di.applyOperation(op);
var id = entity.getId();
...
op = new RAddObjectsOperation();
entity = doc.queryEntity(id);
op.deleteObject(entity);
di.applyOperation(op);