Results 1 to 6 of 6

Thread: Random crashes with dynamic tabs

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,332
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    317
    Thanked 871 Times in 858 Posts

    Default Re: Random crashes with dynamic tabs

    Try using "tab->deleteLater()" instead of "delete tab". This defers actual deletion until the next time the event loop runs, which allows Qt to remove the widget and clean up.

    Setting "tab = NULL" in the next line really does nothing except to set the value of your local variable that contains the pointer to NULL. It is no different from having an "int" local variable and setting its value to something. As soon as the method exits, the stack is cleaned up and all those local variables go away.

  2. The following user says thank you to d_stranz for this useful post:

    scuba (21st September 2015)

Similar Threads

  1. Replies: 1
    Last Post: 12th June 2014, 07:27
  2. semi-random crashes in QByteArray::data()
    By tuli in forum Qt Programming
    Replies: 10
    Last Post: 27th May 2013, 22:24
  3. Replies: 4
    Last Post: 21st October 2012, 19:04
  4. How to debug random crashes?
    By Gunnar in forum Qt Programming
    Replies: 5
    Last Post: 21st November 2011, 21:25
  5. Replies: 1
    Last Post: 7th April 2010, 16:26

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.