Results 1 to 2 of 2

Thread: QThread vs QThread* and QThread: Destroyed while thread is still running warning

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: QThread vs QThread* and QThread: Destroyed while thread is still running warning

    This nothing specific about QThreads, but normal C/C++ behaviour.

    Case 1: In which you get warning, TestThread obejcts are created on stack, with local scope, compiler calls destructor at the end of main()
    Case 2: In which no warning, TestThread obejcts are created on heap (dynamic object), compiler does not explicitly destroy this, you have write code to manually delete these objects on heap. Objects not destroyed - so no warnning.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

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

    Axtroz (4th October 2012)

Similar Threads

  1. How can I get the thread ID out of QThread
    By Artschi in forum Qt Programming
    Replies: 9
    Last Post: 8th November 2017, 03:27
  2. Replies: 11
    Last Post: 12th September 2012, 16:25
  3. QThread not running in different thread
    By lauwe in forum Qt Programming
    Replies: 2
    Last Post: 27th February 2011, 23:02
  4. Replies: 4
    Last Post: 26th June 2008, 18:41
  5. QThread: Destroyed while thread is still running
    By Shuchi Agrawal in forum Newbie
    Replies: 8
    Last Post: 3rd April 2007, 06:27

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.