PDA

View Full Version : QUndoStack Issue/Crash



brcain
17th December 2013, 01:06
Hello,

When is it permissible to call QUndoStack::clear()?

I tried doing so at the end of an undo operation and it resulted in a crash.
9858.

However, if I use a single-shot timer and clear the QUndoStack just 1 millisecond later there is no crash.

The reason for clearing the QUndoStack admittedly seems odd, but I'm having trouble with redo commands related to item groups (forum post, 'QGraphicsItemGroup and undo/redo error' (http://www.qtcentre.org/threads/57302-QGraphicsItemGroup-and-undo-redo-error)).

Thanks,
Ben

wysota
17th December 2013, 07:47
I answered your other post but to answer this one as well -- you can clear the stack anytime you want as long as after the operation nobody tries to access pointers to stack content. The latter may happen e.g. when the pointer to an item is emitted as a signal parameter and two or more slots attach to that signal.