QPlatformWindow::requestUpdate() Assert
-
Hello there,
I am usingQt 5.13
. My application crashes in theqplatformwindow.cpp
file, line758
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()
, whereapp
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 someWindow
components. This issue happens at changing theWindow
mode from full screen to windowed mode and vice versa.I would appreciate all hints regarding debugging this issue further.
-
@Bremenpl said in QPlatformWindow::requestUpdate() Assert:
call stack
Is there anything from your own source code in the stack?
-
@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 theWindow
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...
-
@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):
- 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 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.
-
@JKSH Hi, unfortunately the problem persist with MSVC... I thought I have tested this through, but apparently not:
ASSERT: "!d->updateTimer.isActive()" in file kernel\qplatformwindow.cpp, line 758
I think I will have to fill in that bug report.
-
@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.
-
@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:
- Make a copy of your project
- Gradually remove large chunks of your code until the problem disappears
- Restore the last chunk to bring back the problem
- 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 crashesHas 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?)