[Interest] QGaphicsItem deletion

Igor Mironchik igor.mironchik at gmail.com
Wed Jun 15 15:15:03 CEST 2016


Hi folks,

Let's say I have QGraphicsItem, let it be Line. This Line has move 
handles - another QGraphicsItems, rectangles. Parent of the handles is 
the same as Line's. But Line own objects of handles with QScopedPointer.

When Line creates in c_tor() it creates handles, so handles adds to the 
scene after Line. When I delete Line from the scene by hand everything 
is fine: Line deletes and QScopedPointers free handles.

But if I close application and scene destroys with d_tor() in which it 
deletes all child items. So my question is it possible that handle will 
be deleted before Line, so QScopedPointer will try to free already 
deleted pointer?

Thank you.



More information about the Interest mailing list