How to avoid qtwebengine to crash main program?



  • I load many urls in a QWebEngineView object, one by one. Some urls are displayed normally, some will make my app crash. I do not know if it is a Qt problem or chromium problem. But can I avoid qtwebengine to crash main program so I can continue to load the following urls? It should be something like:

    for(i=0;i<100;i++)
        {
            try
            {
                view->load(urls[i]);
            }
            catch(...)
            {
            }
        }
    

    But since QWebEngineView::load is an asynchronous function, I could not use the above code to ignore the failed url.



  • @yetanotherqtfan
    If it is genuinely "crashing" I don't think you will be able to do much about it. You can use some of the QWebEngineView::load...() signals to monitor how far it is getting, but that's about it, and it won't affect the behaviour anyway. You could Google for qwebengineview crash, there are a few hits, you could see whether your situation corresponds to any of them.



  • @JonB Thank you for your suggestion. I would like to know if there is a method to bypass the error and continue to load subsequent urls. Is there any exception thrown by QtWebEngine that can be caught? If there is, how can I catch those exceptions?



  • @yetanotherqtfan
    As I said, I'm afraid not to the best of my knowledge.

    You might try running your app inside debugger to get backtrace on crash. It sometimes gives a clue. I think one thing to make sure is that you have up-to-date graphics card driver. Also, you might see whether same page crashes inside Google as from QWebEngine: in principle I would expect Chromium engine to behave similarly....



  • QtWebEngine should not crash your app. Please file a bug report with a sample program at bugreports.qt.io.


Log in to reply