Results 1 to 2 of 2

Thread: Solution to one typeof "QObject : Do not delete object, xxx, during its event handler

  1. #1
    Join Date
    Nov 2007
    Posts
    9
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Solution to one typeof "QObject : Do not delete object, xxx, during its event handler

    Had to chase a bug today that was a run-time:

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

    I had a subclass of QMainWindow, that I ended up turning into my own MainWindow class, which I would further subclass, as Window, in my applications.

    The only message I was getting was as above and my google searches proved unfruitful so I post here what I did wrong in hope to help others.

    Basically, I put a QAction in the MainWindow class and forgot to remove it from Window. So the application would compile but die right away with the wonderful QObject: Do not delete error. Took me a while to figure out the problem was quite simple, there were two QActions with the same name, one in MainWindow and one in Window. This led to the error and removing the unwanted one from Window solved the problem.

    Unfortunately, I cannot explain anything about the error. Even now, having fixed it, it is not totally clear to me what Qt is trying to tell me with it.

  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: Solution to one typeof "QObject : Do not delete object, xxx, during its event han

    It's more likely you were implicitly deleting some object (like a tool button tied to an action you were removing maybe) as a result of a signal (or event) originating from the object that was being deleted.
    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.


Similar Threads

  1. Replies: 2
    Last Post: 19th July 2009, 11:44
  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

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.