Crash after QWebFrame::setHtml

560 views Asked by At

I'm trying to set html content dynamically to document node in the main thread.

                QWebElement dynamicContent = ui->webView->page()->mainFrame()->documentElement().findFirst("div#dynamicContent");
                if (QWebFrame *frame = dynamicContent.webFrame())
                {
                    param = "<html><body></body></html>";
                    frame->setHtml(param);
                }

These lines are executed normally, but after that i get read access violation with call stack

0   QWebPluginDatabase::searchPaths QtWebKitd4      0x1009deca  
1   QWebPluginDatabase::searchPaths QtWebKitd4      0x10749451  
2   QWebPluginDatabase::searchPaths QtWebKitd4      0x10749434  
3   QWebPluginDatabase::searchPaths QtWebKitd4      0x10749347  
4   QWebPluginDatabase::searchPaths QtWebKitd4      0x10748469  
5   QWebPluginDatabase::searchPaths QtWebKitd4      0x1074856f  
6   QWebPluginDatabase::searchPaths QtWebKitd4      0x107100d6  
7   QWebPluginDatabase::searchPaths QtWebKitd4      0x107244ce  
8   QWebPluginDatabase::searchPaths QtWebKitd4      0x1074cd58  
9   QWebPluginDatabase::searchPaths QtWebKitd4      0x109f9462  
10  QWebPluginDatabase::searchPaths QtWebKitd4      0x109fa78e  
11  QWebPluginDatabase::searchPaths QtWebKitd4      0x10725e17  
12  QWebPluginDatabase::searchPaths QtWebKitd4      0x10725b25  
13  QWebPluginDatabase::searchPaths QtWebKitd4      0x1074c180  
14  QWebPluginDatabase::searchPaths QtWebKitd4      0x1074cf2e  
15  QWebPluginDatabase::searchPaths QtWebKitd4      0x109f9462  
16  QWebPluginDatabase::searchPaths QtWebKitd4      0x109fcdb2  
17  QWebPluginDatabase::searchPaths QtWebKitd4      0x1074ca2e  
18  QWebPluginDatabase::searchPaths QtWebKitd4      0x10721800  
19  QWebPluginDatabase::searchPaths QtWebKitd4      0x10721383  
20  QWebPluginDatabase::searchPaths QtWebKitd4      0x107253c3  
21  QWebPluginDatabase::searchPaths QtWebKitd4      0x10720293  
22  QWebPluginDatabase::searchPaths QtWebKitd4      0x10750cba  
23  QWebPluginDatabase::searchPaths QtWebKitd4      0x10751ab9  
24  QWebPluginDatabase::searchPaths QtWebKitd4      0x108639e4  
25  QWebPluginDatabase::searchPaths QtWebKitd4      0x10863916  
26  QWebPluginDatabase::searchPaths QtWebKitd4      0x109ecb72  
27  QTemporaryFile::tr  QtCored4        0x671ec7fa  
28  QPictureIO::init    QtGuid4     0x65071a2e  
29  QPictureIO::init    QtGuid4     0x6506f6aa  
30  QTemporaryFile::tr  QtCored4        0x671ceb81  
31  QTemporaryFile::tr  QtCored4        0x671d3d29  
32  QTemporaryFile::tr  QtCored4        0x67214812  
33  QPictureIO::init    QtGuid4     0x65071a2e  
34  QPictureIO::init    QtGuid4     0x6506f6aa  
35  QTemporaryFile::tr  QtCored4        0x671ceb81  
36  QTemporaryFile::tr  QtCored4        0x671d3d29  
37  QTemporaryFile::tr  QtCored4        0x671cfadb  
38  QTemporaryFile::tr  QtCored4        0x672129dd  
39  InternalCallWinProc USER32      0x74d66238  
40  UserCallWinProcCheckWow USER32      0x74d668ea  
41  DispatchMessageWorker   USER32      0x74d67d31  
42  DispatchMessageW    USER32      0x74d67dfa  
43  QTemporaryFile::tr  QtCored4        0x672139f6  
44  QPictureIO::init    QtGuid4     0x6512c4ce  
45  QTemporaryFile::tr  QtCored4        0x671cc68e  
46  QTemporaryFile::tr  QtCored4        0x671cc7c0  
47  QTemporaryFile::tr  QtCored4        0x671cf0fd  
48  QPictureIO::init    QtGuid4     0x6506f398  
49  main    main.cpp    28  0x401ec9    

Any googling or stackoverflowing of problem did not succeed. Had anyone else the same issue? What is the proper usage of QWebFrame::setHtml?

Thank you

[Solved] This issue happens while calling QWebFrame::setHtml not from main thread.

1

There are 1 answers

0
Orange On BEST ANSWER

Have solved this issue, and answer is DO NOT use setHtml method from thread, that differs from main.