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. Bug in the Mandelbrot example?

Bug in the Mandelbrot example?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 278 Views
  • 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.
  • M Offline
    M Offline
    maliberty
    wrote on last edited by
    #1

    In https://doc.qt.io/qt-6/qtcore-threads-mandelbrot-example.html it says:

    If we discover inside the loop that restart has been set to true (by render()), we break out of the loop immediately, so that the control quickly returns to the very top of the outer loop (the forever loop) and we fetch the new rendering parameters.
    

    However when I look the code I see the break is:

    void RenderThread::run()
    {
        forever {
            //    ...
            while (pass < NumPasses) {
                // ...
                for (int y = -halfHeight; y < halfHeight; ++y) {
                    if (restart)
                        break;
    

    The break will break the for loop but not he while loop. I don't see anything that breaks the while loop to "quickly return" to the forever loop.

    Am I missing something or is this a bug?

    Thanks

    Christian EhrlicherC 1 Reply Last reply
    0
    • M maliberty

      In https://doc.qt.io/qt-6/qtcore-threads-mandelbrot-example.html it says:

      If we discover inside the loop that restart has been set to true (by render()), we break out of the loop immediately, so that the control quickly returns to the very top of the outer loop (the forever loop) and we fetch the new rendering parameters.
      

      However when I look the code I see the break is:

      void RenderThread::run()
      {
          forever {
              //    ...
              while (pass < NumPasses) {
                  // ...
                  for (int y = -halfHeight; y < halfHeight; ++y) {
                      if (restart)
                          break;
      

      The break will break the for loop but not he while loop. I don't see anything that breaks the while loop to "quickly return" to the forever loop.

      Am I missing something or is this a bug?

      Thanks

      Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      You did not post the whole code. After the if() statement pass is increased so the while loop is ready very quickly and it returns to the forever()

      Not optimal but also not really a problem.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • M Offline
        M Offline
        maliberty
        wrote on last edited by
        #3

        @maliberty said in Bug in the Mandelbrot example?:

        we break out of the loop immediately

        So not "immediately" but quickly enough.

        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