Results 1 to 3 of 3

Thread: qApp->processEvent() cause crash

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2015
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Android

    Default qApp->processEvent() cause crash

    There's one confused err in my code.
    pseudo code as follows:

    connect(mysignal, myslot);
    connect(mtsignal_2, myslot);

    void myslot(QString msg)
    {
    textEdit->append(msg);
    qApp->processEvents(); //if comment this line, no crash, but other function also use this to prevent UI hang
    }

    void func()
    {
    for(i=0;i<n;i++)
    emit mysignal;
    }

    [problem] when i increase to some fixed value, exe crash, err stack overflow in ntdll.dll

    how to solve this bug?
    Thanks in advance!

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: qApp->processEvent() cause crash

    Why would you even want to call that in there?

    Cheers,
    _

  3. #3
    Join Date
    Oct 2009
    Posts
    483
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanked 97 Times in 94 Posts

    Default Re: qApp->processEvent() cause crash

    Calling qApp->processEvents() only makes sense in the middle of a long-running computation ; it is useless just before control returns to the event loop, as is the case here.

Similar Threads

  1. Qt-based dll: qApp = 0 !!
    By Elder Orb in forum Qt Programming
    Replies: 6
    Last Post: 14th September 2010, 17:15
  2. qApp->sessionId() does not gives session id on Mac OS X
    By sanjayshelke in forum Qt Programming
    Replies: 1
    Last Post: 12th November 2009, 10:37
  3. qApp is not accesible
    By URPradhan in forum Qt Programming
    Replies: 5
    Last Post: 10th July 2009, 04:23
  4. qApp->processEvents();
    By rmagro in forum Qt Programming
    Replies: 8
    Last Post: 13th March 2009, 18:34
  5. how to use qApp inside a dll?
    By oob2 in forum Qt Programming
    Replies: 1
    Last Post: 23rd June 2006, 23:15

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.