QApplication::processEvents(); causes instant crash on Windows with Qt 5 beta!

  • Hi,

    I ported my Qt desktop application from Qt 4 to Qt 5 today. It compiles an runs fine but as soon as I display text in my application's QTextEdit and call QApplication::processEvents(); to keep the GUI responsive the application crashes instantaneously. Using Qt 4.7 and 4.8 it works fine.

    Is this a bug in Qt 5 beta? Is there a workaround, if I do not use QApplication::processEvents(); my application becomes unresponsive an won't accept user input.

    Thanks for your help,

  • Just one thing from my own experience: You have to be VERY careful with QApplication::processEvents() and infinite recursions! If not taken care of properly, it can happen easily that QApplication::processEvents() processes an event that calls the same Slot function from which you are calling QApplication::processEvents(). This will cause an infinite recursion and crash with stack overflow...

  • Thanks for your answer,

    Yes, I know that one must be careful with "QApplication::processEvents()" and that it might cause stackoverflows on systems with signal recursion like Linux/X11. But it worked fine on Windows and Mac OS X with Qt 4 so I guess that Qt 5 now uses signal recursion on Windows while it previously did not?

  • I'm afraid with that little information noone will be able to help, even if he wants to.

    Have you already started your application in the debugger to see where it actually crashes?
    How exactly does it crash? Does it segfault, or is it a stack overflow?
    Have you taken a look at the stack trace to verify you are not in a recursive trap?

Log in to reply