qt - Crash when delete QGraphicsItem -


i want remove items in qgraphicsscene , delete them. this,

qgraphicsitem * item = null; foreach(item, scene->items()) {     scene->removeitem(item);     delete item; } 

however, crashed segmentation fault after running block of codes , getting out loop. , in debug mode, debugger jumped assembly file: enter image description here what's going wrong?

if deleting items scene, why dont "clear" shown below. have scene object right.

scene-> clear();

as per documentation: void qgraphicsscene::clear()

removes , deletes items scene, otherwise leaves state of scene unchanged.

this function introduced in qt 4.4.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -