Results 1 to 2 of 2

Thread: QUndoStack Issue/Crash

  1. #1
    Join Date
    Feb 2006
    Location
    US
    Posts
    173
    Thanks
    16
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default QUndoStack Issue/Crash

    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.
    QUndoStack_clear_crash.jpg.

    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').

    Thanks,
    Ben

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QUndoStack Issue/Crash

    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    brcain (17th December 2013)

Similar Threads

  1. QAbstractItemModel with QUndoStack
    By No-Nonsense in forum Qt Programming
    Replies: 7
    Last Post: 28th October 2012, 17:15
  2. Thread Crash issue while using sendDTMFTones
    By Vaibhav.sood15 in forum Qt Quick
    Replies: 1
    Last Post: 26th October 2012, 07:10
  3. Replies: 0
    Last Post: 3rd August 2010, 11:47
  4. QTreeWidget and QUndoStack?
    By olihey in forum Qt Programming
    Replies: 0
    Last Post: 7th July 2010, 09:08
  5. QUndoStack problem
    By swiety in forum Qt Programming
    Replies: 1
    Last Post: 24th October 2007, 21:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.