QPlatformWindow::requestUpdate() Assert



  • Hello there,
    I am using Qt 5.13. My application crashes in the qplatformwindow.cpp file, line 758 where assertion is failed. This is the function:

    /*!
        Requests an QEvent::UpdateRequest event. The event will be
        delivered to the QWindow.
    
        QPlatformWindow subclasses can re-implement this function to
        provide display refresh synchronized updates. The event
        should be delivered using QPlatformWindow::deliverUpdateRequest()
        to not get out of sync with the the internal state of QWindow.
    
        The default implementation posts an UpdateRequest event to the
        window after 5 ms. The additional time is there to give the event
        loop a bit of idle time to gather system events.
    
    */
    void QPlatformWindow::requestUpdate()
    {
        Q_D(QPlatformWindow);
    
        static int updateInterval = []() {
            bool ok = false;
            int customUpdateInterval = qEnvironmentVariableIntValue("QT_QPA_UPDATE_IDLE_TIME", &ok);
            return ok ? customUpdateInterval : 5;
        }();
    
        Q_ASSERT(!d->updateTimer.isActive());
        d->updateTimer.start(updateInterval, Qt::PreciseTimer, window());
    }
    

    I was trying to unroll the call stack in order to check what could be causing this, but its simply too long at starts at app.exec(), where app is:

    QGuiApplication app(argc, argv);
    

    In the main.c. I would like to post my code but its simply too big... I can try to describe the situation at which this is happening. Basically in the QML part I have some Window components. This issue happens at changing the Window mode from full screen to windowed mode and vice versa.

    I would appreciate all hints regarding debugging this issue further.


  • Qt Champions 2018

    @Bremenpl said in QPlatformWindow::requestUpdate() Assert:

    call stack

    Is there anything from your own source code in the stack?



  • @jsulm No



  • @jsulm Actually, its hard to tell. There is some USER CALL entry, but I am not able to unroll it:

    0_1561445664796_1-41.png

    0_1561445655329_35-74.png



  • @jsulm Hi, any new ideas?


  • Qt Champions 2018

    @Bremenpl The only idea I have is to check on Qt bug tracker and if you don't find anything file a bug.



  • @jsulm Ok, will have to do that. Thanks.
    Just so you know, this problem only occurs in Windows OS. In linux everything works fine. I dont have the possibility to check on Mac OS right now.


  • Moderators

    @Bremenpl said in QPlatformWindow::requestUpdate() Assert:

    I would like to post my code but its simply too big... I can try to describe the situation at which this is happening. Basically in the QML part I have some Window components. This issue happens at changing the Window mode from full screen to windowed mode and vice versa.

    I would appreciate all hints regarding debugging this issue further.

    First, check to see if this happens on a bare-bones, Hello World application with a bare Window.

    If it does, check to see if this happens on a very different compiler (e.g. if you're currently using MSVC, check MinGW)



  • @JKSH Hi, I have a followup question:
    I want to investigate the MSC compiler solution, but I was wondering:

    • What compiler was used to compile the Qt version (Windows) one downloads using the official installer? Was it MinGW or MSC?
    • In case it was compiled with MinGW, wont my compiling using MSC be in conflict at some hard to track point?
    • In case it was compiled with MinGW, should I dowload the sources and compile Qt myself using MSC if I wanted to continue using it with MSC compiler?

    I am asking because I have never really used MSC compiler with Qt in a serious way- there was always some problems setting it up or compiling, while MinGW worked flawlessly so far...


  • Moderators

    @Bremenpl said in QPlatformWindow::requestUpdate() Assert:

    @JKSH Hi, I have a followup question:
    I want to investigate the MSC compiler solution, but I was wondering:

    • What compiler was used to compile the Qt version (Windows) one downloads using the official installer? Was it MinGW or MSC?

    Both variants are provided. When you run the installer, you choose which version(s) you want (notice that you can even choose from multiple versions of MSVC):

    Qt installer screenshot

    • In case it was compiled with MinGW, wont my compiling using MSC be in conflict at some hard to track point?

    It won't be hard to track. When building your project, if you try to link against DLLs that were built using a different compiler, the link will fail completely.

    • In case it was compiled with MinGW, should I dowload the sources and compile Qt myself using MSC if I wanted to continue using it with MSC compiler?

    No, just install the versions you want from the installer.

    I am asking because I have never really used MSC compiler with Qt in a serious way- there was always some problems setting it up or compiling, while MinGW worked flawlessly so far...

    I've had no problems. I just install the C++ compiler for Visual Studio, and then Qt Creator auto-detects the compiler.

    It's MSVC, by the way. It stands for the Microsoft Visual C++ compiler.



  • @JKSH thank you for the followup. In this case I will start from instling the msvc compiler. Also my bad about the spelling.



  • @JKSH Hello again,
    After you suggestion, I have installed the MSVC 2017 x64 compiler and set it up with Qt Creator. After compiling and testing the code with it, the described bug does not occur. I will stick to this compiler from now on on the Windows platform.

    Thank you again for your feedback and help.


  • Moderators

    @Bremenpl I'm glad your issue is resolved. Do mark the topic as "Solved" (under the "Topic Tools" button)

    Happy coding!



  • @JKSH Hi, unfortunately the problem persist with MSVC... I thought I have tested this through, but apparently not:

    0_1563184343726_97e4dca4-4fed-4772-b538-7866c69a5872-image.png

    ASSERT: "!d->updateTimer.isActive()" in file kernel\qplatformwindow.cpp, line 758
    

    I think I will have to fill in that bug report.


  • Moderators

    @Bremenpl said in QPlatformWindow::requestUpdate() Assert:

    unfortunately the problem persist with MSVC...

    Does it only occur in your app?

    Or does it also occur on a very small, simple, "Hello World" application?



  • @JKSH Hi, thanks for answer.
    It only occurs in my program. Creating an MWE would be a bit tricky, since there is a lot of logic there. I highly predict that even If I would extract the functionality to an MWE, then the problem would not exist anymore. I have to try anyways though.

    For example, now, as a workaround, I replaced all occurencies of window automatic visibility setting to maximized in the qml part. Also, each time a window ia opened, I donr set the visibility immidietally, but start a timer that will do that for me 10 ms later. The problem stopped occuring but the workaround is very bad looking.


  • Moderators

    @Bremenpl said in QPlatformWindow::requestUpdate() Assert:

    It only occurs in my program. Creating an MWE would be a bit tricky, since there is a lot of logic there. I highly predict that even If I would extract the functionality to an MWE, then the problem would not exist anymore. I have to try anyways though.

    A systematic way to locate the problem is:

    1. Make a copy of your project
    2. Gradually remove large chunks of your code until the problem disappears
    3. Restore the last chunk to bring back the problem
    4. Gradually remove other bits until the problem disappears

    Keep repeating until you have an MWE.

    now, as a workaround, I replaced all occurencies of window automatic visibility setting to maximized in the qml part. Also, each time a window ia opened, I donr set the visibility immidietally, but start a timer that will do that for me 10 ms later. The problem stopped occuring but the workaround is very bad looking.

    Having a usable workaround is a good thing.

    It would be good to find out if the issue is in your code or in Qt itself.

    @Bremenpl said in QPlatformWindow::requestUpdate() Assert:

    I am using Qt 5.13. My application crashes

    Has this always happened with your application? Do you remember when the problem started? (For example... After you upgraded to Qt 5.13? After you added a new feature?)



  • @JKSH will try to make the MWE the way you instructed me to do. Thanks. As for the version- I really cant tell, since i prev qt version I was not that far in the project progress...


Log in to reply
 

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