Results 1 to 2 of 2

Thread: QObject::deleteLater

  1. #1
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default QObject::deleteLater

    Hi,

    When have the funciton "QObject::deleteLater" be used? Is any problem for example, creating a dialog without telling it to "deleteLater" ?

    I noted that is used in many Qt examples but the documentation don't let me know if I must use it.

    Thanks,
    Òscar Llarch i Galán

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

    Default Re: QObject::deleteLater

    deleteLater() schedules a delete request after all the events have been processed. It is needed for example in slots, where you want to delete an object that could have signals waiting to be delivered and deleting the object immediately would cause a crash because some slots would try to operate on the object after it has been deleted. You don't need it for your dialog.

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

    ^NyAw^ (27th November 2007)

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.