Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

gui event loop does not work



  • there is an application that has two labels for video output, and several more labels to output their size, which should rightly increase as the video displayed on the screen is recorded. I have the following problem: at some point in time (an average of a couple of minutes) everything in the application as-hangs. The numbers with the file size do not increase, the images from the camera do not change. but the debug output shows that the application is working. when I press the stop button, which stops the recording, the images in the labels instantly change to the current ones (my hand with the mouse, pushing the stop), the file sizes are displayed correctly and the application stops correctly, which is also visible on the debug output. I guess that at some point my application stops processing the events in the gui until I myself do not generate it (pressing a button). Which way should I look? Why can this happen?


  • Qt Champions 2019

    @danyal What you describe sounds like you're blocking the event loop. Are you doing heavy tasks in GUI thread? Do you have any long lasting loops in your GUI thread?


  • Lifetime Qt Champion

    Hi,

    You need to provide more details.

    What version of Qt are you using ?
    On what platform ?
    With which compiler ?
    How are these videos fed to your application ?
    Are you doing anything else in your application beside showing these videos ?



  • @jsulm My application is divided into two thread. The main thread is where the gui and audio record and the thread are for taking a picture from the camera (two images: color and depth of the intel realsense 300). After the main thread processes the start event and starts it all, it is more responsible for recording the sound with QAudioRecorder. And it also has to process events and signals. In this thread, 10 times a second, label with information about the size of files and a label with information and the duration of the application are updated. I just turned off and write about the size of the files and my application began to work longer. Now I turned off the audio recording and it seems to work even better. Could it be that the message queue just can not cope with so many messages?



  • @SGaist qt 5.10.1 , windows 10, msvc 14.0, video get from intel realsense sdk


  • Lifetime Qt Champion

    @danyal said in gui event loop does not work:

    Could it be that the message queue just can not cope with so many messages?

    Yes, if the thread emit too fast due to tight loop.
    Normally you slow it down a bit wiht something like
    QTimer::singleShot(1, this, &Task::doWork)
    Where doWork is the method that performs the processing in the
    QObject you used moveToThread on.
    (if using the worker approach)



  • Hey! I'm also using Qt5.10.1, windows 10, msvc 14.0, intel realsense sdk.
    I'm facing a problem in the rs_frame.hpp with some syntax errors.
    It's so weird. Did you face the same problem before?
    Or if you can share your .pro file or other helpful files?
    Thanks a lot!


  • Lifetime Qt Champion

    Hi and welcome to the forums.
    While not strictly Qt, if you paste the actual errors you get in/from rs_frame.hpp
    someone might give a good guess on what is wrong.


Log in to reply