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. Setting value to QProgressBar causes program to crash
Forum Updated to NodeBB v4.3 + New Features

Setting value to QProgressBar causes program to crash

Scheduled Pinned Locked Moved Solved General and Desktop
15 Posts 4 Posters 4.8k Views 2 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.
  • T Tirupathi Korla

    @bs55
    Are you sure your application is crashing in this function??

    B Offline
    B Offline
    bs55
    wrote on last edited by
    #6

    @Tirupathi-Korla Yes because when I comment this line

    // qpb_Progress->setValue((int) d_Average); 
    

    the program doen not crash...

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #7

      Is qpb_Progress initialised properly ?

      Can you show the stack trace ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      B 1 Reply Last reply
      0
      • SGaistS SGaist

        Is qpb_Progress initialised properly ?

        Can you show the stack trace ?

        B Offline
        B Offline
        bs55
        wrote on last edited by
        #8

        @SGaist The QProgressBar is initialized by this line:

        qpb_Progress = new QProgressBar(this);
        

        The stack trace is as follows:

        Thread # 1 :  50 %.
        Thread # 0 :  50 %.
        QWidget::repaint: Recursive repaint detected
        Average progress: 25 %.
        The program has unexpectedly finished.
        The process was ended forcefully.
        /home/remi/Documents/Internship/MyProjects/build-SpinnakerSandboxQt3-Desktop-Debug/SpinnakerSandboxQt crashed.
        

        It does not occur when I use only one camera (and therefore one thread) so my guess is that the function is executed twice simutanously and that it causes a conflict when the two instance try to access the QProgressBar at the same time...

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #9

          Are you trying to update GUI elements directly your threads ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          B 1 Reply Last reply
          0
          • SGaistS SGaist

            Are you trying to update GUI elements directly your threads ?

            B Offline
            B Offline
            bs55
            wrote on last edited by
            #10

            @SGaist No the thread emit a signal that is connected to a slot in the MainWindow...

            1 Reply Last reply
            0
            • mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #11

              Hi
              I tried with 2 worker objets to have them bombard a ProgressBar
              in mainwindow but i couldn't get the same error.

              B 1 Reply Last reply
              0
              • mrjjM mrjj

                Hi
                I tried with 2 worker objets to have them bombard a ProgressBar
                in mainwindow but i couldn't get the same error.

                B Offline
                B Offline
                bs55
                wrote on last edited by
                #12

                @mrjj Maybe the error only occurs on Linux.
                Considering the number of cameras and their framerate it will be called up to 2440 times per second (that's one call every 0.41 milliseconds). Maybe Qt isn't up for the task...

                mrjjM 1 Reply Last reply
                0
                • B bs55

                  @mrjj Maybe the error only occurs on Linux.
                  Considering the number of cameras and their framerate it will be called up to 2440 times per second (that's one call every 0.41 milliseconds). Maybe Qt isn't up for the task...

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #13

                  @bs55
                  Hi
                  hard to say as im not sure what give the
                  "Recursive repaint detected"
                  it does sound like a paint is in progress while new one started but
                  signals should prevent that. ( i tried with 6 threads but still no error)

                  Qt uses native tasks so if its not fast enough, you might need other design to reach such speeds.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #14

                    You do realise that most screens have at most a 60fps refresh rate while the human eyes is already fooled at 24 ? So having a 2440 Hz refresh rate is useless and from the looks of it you are even overloading your application with that.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    B 1 Reply Last reply
                    1
                    • SGaistS SGaist

                      You do realise that most screens have at most a 60fps refresh rate while the human eyes is already fooled at 24 ? So having a 2440 Hz refresh rate is useless and from the looks of it you are even overloading your application with that.

                      B Offline
                      B Offline
                      bs55
                      wrote on last edited by
                      #15

                      @SGaist You're right, the function to register the progress of each threads will be called 2440 times per second but I should create another function just to refresh the progress bar that would be called less often...

                      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