Infinite loop on QApplication::processEvents() in Qt5



  • In QDialogs where I use processEvents() - but never in a paint or resize event - I found my application in an infinite loop.

    I first noticed this was triggered when using a QComboBox which changed focus (either to or from) but it has also occurred at other strange times when interacting with the dialog.

    MacOS X 10.8.2/10.8.3 and Qt 5.0.1



  • Using processEvents() always is dangerous and has to be used with extreme care! That's because, as the name implies, it will process all pending events. And these events may very well trigger a signal that calls the same slot (or event handler function) where you call processEvents(). This can lead to infinite recursion...



  • @MuldeR

    The exact same code worked nicely in Qt 4.7.4 for a long time.

    For the two dialogs where I have experienced this, there were no events that could call the slot that went into the loop.



  • [quote author="kegon" date="13w63657419"]@MuldeR
    The exact same code worked nicely in Qt 4.7.4 for a long time.[/quote]

    Not really an argument. I had code that worked nice in an older version - only because of a bug in Qt. When that bug was fixed, my code stopped working. And then, after I found out, I had to fix my code to make it work again...

    [quote author="kegon" date="1363657419"]For the two dialogs where I have experienced this, there were no events that could call the slot that went into the loop.[/quote]

    I guess you will have to create a minimal example code that reproduces the issue...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.