Results 1 to 3 of 3

Thread: QObject : Do not delete object, 'unnamed', during its event handler

  1. #1
    Join Date
    Mar 2009
    Posts
    20
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QObject : Do not delete object, 'unnamed', during its event handler

    Hi all,
    I have a new question need you help.
    In the mainwindow, I have a button to close a sub-window, and its shortcut is "ctrl + w"
    when I click this button, the program works ok, but if I use its shortcut, there is an information:
    "QObject: Do not delete object, 'unname' , during its event handler" .When I close this sub-window, I will delete some object to release memory, when delete the object which inherits QGraphicsView, this information will occur.
    If you have some addvice, please help me ,thanks!

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QObject : Do not delete object, 'unnamed', during its event handler

    This means (as the message says) that you delete some object while one of its events is being processed. You should not do that.
    Use deleteLater() instead. See, QObject::deleteLater().

    HTH

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

    ultr (18th February 2010)

  4. #3
    Join Date
    Mar 2009
    Posts
    20
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QObject : Do not delete object, 'unnamed', during its event handler

    Hi caduel,
    Thanks for your help firstly !
    According to your advice, I fix the bug, thanks again !

Similar Threads

  1. Deleting objects in their event handler
    By drhex in forum Qt Programming
    Replies: 7
    Last Post: 6th May 2009, 16:08
  2. Replies: 4
    Last Post: 19th February 2009, 11:10
  3. Is it bad to delete an object during its event handler?
    By codeslicer in forum Qt Programming
    Replies: 3
    Last Post: 30th December 2008, 16:14
  4. Replies: 1
    Last Post: 31st October 2007, 14:14

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.