Question

im using Qt 5.0 + mingw to build my applications and i want to use the "webkitwidgets" module. I add in .pro file

QT += webkitwidgets

Then in my code i created a thread and i the this thread i wrote:

 QWebPage page;

When debugger gets to this line, my debug terminates with the following error:

"Microsoft visual c++ runtime library

This application has requested the Runtime to terminate it an unusual way. Please contact the application's support team for more infomation."

So i cant even declare a variable of the type QWebPage. Why this happens and is there a way to fix it?

Was it helpful?

Solution

When experiencing crashes like this, first watch stdout, stderr and the debug channel, then run it in a debugger.

However, as you say that you created QWebPage in a thread: That won't work. In Qt (and almost all other UI toolkits), all UI classes must live in the main thread, i.e. the one QApplication lives in. Move the declaration to the main thread and it should work. Also, creating the instance on the stack is only the right thing if the block isn't left before the application quits (usually that's only the case in main()). Otherwise you must create it on the heap.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top