[Development] Clarification needed on a crash caused by ignoring ownership of an object

Andy Shaw andy.shaw at qt.io
Thu May 4 09:58:45 CEST 2017


Hi,

I am trying to determine what we should be doing inside Qt in a certain case. When a QUndoCommand is deleted after it has been given another QUndoCommand as a parent it will cause a crash since the parent has not been informed that the child was deleted. The documentation for QUndoCommand is explicit on the fact that when it has a parent the ownership of the QUndoCommand is transferred to its parent. As such I would not expect it to be possible to delete the child directly anymore as a result as we no longer own it. 

So the question is, since it is still a crash, should we still be accounting for this in the Qt code so as to prevent the crash or is it a case of it is documented to transfer ownership and as such we don’t want to protect against it being deleted out of Qt’s hands?

Andy



More information about the Development mailing list