Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Infinite loop on QApplication::processEvents() in Qt5

Infinite loop on QApplication::processEvents() in Qt5

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 3.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kegon
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MuldeR
      wrote on last edited by
      #2

      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...

      My OpenSource software at: http://muldersoft.com/

      Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

      Go visit the coop: http://youtu.be/Jay...

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kegon
        wrote on last edited by
        #3

        @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.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          MuldeR
          wrote on last edited by
          #4

          [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...

          My OpenSource software at: http://muldersoft.com/

          Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

          Go visit the coop: http://youtu.be/Jay...

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved