[Question] Crash if Url is incomplete



  • Good Evening Forum.
    I have the following strange Problem:

    When the Url contains only Strings like ftp:/, ftp://, http:/, http:// etc, the whole Application crashes. I wrote an very simple if else Checkpoint:

    if(errorTestString.endsWith("ftp:/", Qt::CaseInsensitive) || errorTestString.endsWith("ftp://", Qt::CaseInsensitive)
    || errorTestString.endsWith("ftps:/", Qt::CaseInsensitive) || errorTestString.endsWith("ftps://", Qt::CaseInsensitive)
    || errorTestString.endsWith("http:/", Qt::CaseInsensitive) || errorTestString.endsWith("http://", Qt::CaseInsensitive)
    || errorTestString.endsWith("https:/", Qt::CaseInsensitive) || errorTestString.endsWith("https://", Qt::CaseInsensitive))
    {
        //    QWebEnginePage::WebAction stopOnError;
        //stopOnError = QWebEnginePage::Stop;
        m_BrowserModule->triggerPageAction(QWebEnginePage::Stop, true);
      //m_BrowserModule->triggerPageAction(QWebEnginePage::Stop);
    
        QMessageBox::critical(this, "Invalid Url", "Please check Url");
         // m_BrowserModule->triggerPageAction(stopOnError);
         //m_BrowserModule->load(QUrl("www.google.de"));
        }
    else if(!errorTestString.endsWith("ftp:/", Qt::CaseInsensitive) || !errorTestString.endsWith("ftp://", Qt::CaseInsensitive) || !errorTestString.endsWith("ftps:/", Qt::CaseInsensitive) || !errorTestString.endsWith("ftps://", Qt::CaseInsensitive)
    || !errorTestString.endsWith("http:/", Qt::CaseInsensitive) || !errorTestString.endsWith("http://", Qt::CaseInsensitive)
    || !errorTestString.endsWith("https:/", Qt::CaseInsensitive) || !errorTestString.endsWith("https://", Qt::CaseInsensitive))
    {
     m_BrowserModule->load(loadEnteredUrl);
    }
    

    The Error Message in Debug Mode is:

    [1209/200048:FATAL:gurl.cc(177)] Check failed: false. Trying to get the spec of an invalid URL!
    Backtrace:
    	QtWebEngineCore::FilePickerController::mode [0x0000000182639A06+178262]
    	QtWebEngineCore::BrowserContextAdapter::httpCacheMaxSize [0x000000018253843D+6359197]
    	QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000181D4084B+4492763]
    	QtWebEngineCore::BrowserContextAdapter::customUrlSchemeHandlers [0x0000000180A6D029+4996313]
    	QtWebEngineCore::BrowserContextAdapter::customUrlSchemeHandlers [0x0000000180A6DA9D+4998989]
    	QtWebEngineCore::BrowserContextAdapter::customUrlSchemeHandlers [0x0000000180980E31+4029153]
    	QtWebEngineCore::BrowserContextAdapter::customUrlSchemeHandlers [0x0000000180980A70+4028192]
    	QtWebEngineCore::BrowserContextAdapter::customUrlSchemeHandlers [0x000000018097F75D+4023309]
    	QtWebEngineCore::BrowserContextAdapter::customUrlSchemeHandlers [0x00000001809806B0+4027232]
    	QtWebEngineCore::WebContentsAdapter::load [0x0000000180225A28+280]
    	QWebEngineHistory::backItem [0x00007FF8491FD3CC+43449]
    	QWebEngineHistory::backItem [0x00007FF849212765+130386]
    	CBrowser::changeLocation [0x00007FF7E7E3B2C6+614] (c:\meineprogramme\gitprojects\aktool\cbrowser.cpp:65)
    	CBrowser::qt_static_metacall [0x00007FF7E7E6D4CE+142] (c:\meineprogramme\gitprojects\build-aktool-5_6_git_debug-debug\debug\moc_cbrowser.cpp:122)
    	QCoreApplicationPrivate::cleanupThreadData [0x000000005670BB12+4781628]
    	QCoreApplicationPrivate::cleanupThreadData [0x000000005670B298+4779458]
    	QSplashScreen::mousePressEvent [0x00000000572FA984+2850080]
    	QSplashScreen::mousePressEvent [0x00000000572F6803+2833311]
    	QCoreApplicationPrivate::cleanupThreadData [0x000000005670BB12+4781628]
    	QCoreApplicationPrivate::cleanupThreadData [0x000000005670B298+4779458]
    	QSplashScreen::mousePressEvent [0x000000005772B3A4+7243584]
    	QSplashScreen::mousePressEvent [0x00000000573EC026+3838914]
    	QSplashScreen::mousePressEvent [0x00000000572FB243+2852319]
    	QSplashScreen::mousePressEvent [0x00000000570EF4E4+706688]
    	QSplashScreen::mousePressEvent [0x00000000572FD20A+2860454]
    	QSplashScreen::mousePressEvent [0x0000000057084C9E+270394]
    	QSplashScreen::mousePressEvent [0x000000005707FB0B+249511]
    	QCoreApplicationPrivate::cleanupThreadData [0x00000000566B8D46+4442224]
    	QCoreApplicationPrivate::cleanupThreadData [0x0000000056818C6B+5883797]
    	QSplashScreen::mousePressEvent [0x0000000057136092+996398]
    	QSplashScreen::mousePressEvent [0x00000000571358C2+994398]
    	QSplashScreen::mousePressEvent [0x0000000057084C9E+270394]
    	QSplashScreen::mousePressEvent [0x000000005707F9B3+249167]
    	QCoreApplicationPrivate::cleanupThreadData [0x00000000566B8D46+4442224]
    	QCoreApplicationPrivate::cleanupThreadData [0x0000000056818C6B+5883797]
    	QPlatformThemePrivate::initializeSystemPalette [0x00007FF8377594A2+548365]
    	QPlatformThemePrivate::initializeSystemPalette [0x00007FF83775B9C7+557874]
    	QPlatformThemePrivate::initializeSystemPalette [0x00007FF8377178D5+279104]
    	QTextDocumentPrivate::q_func [0x00007FF83745D022+356351]
    	QCoreApplicationPrivate::cleanupThreadData [0x000000005676D6D4+5181950]
    	DispatchMessageW [0x00007FF85C521169+1673]
    	DispatchMessageW [0x00007FF85C520C97+439]
    	QCoreApplicationPrivate::cleanupThreadData [0x000000005676E1F5+5184799]
    	QTextDocumentPrivate::q_func [0x00007FF83745CEF9+356054]
    	QCoreApplicationPrivate::cleanupThreadData [0x00000000566B3958+4420738]
    	QCoreApplicationPrivate::cleanupThreadData [0x00000000566B3B9E+4421320]
     	QCoreApplicationPrivate::cleanupThreadData [0x00000000566B6ABF+4433385]
    	QPlatformThemePrivate::initializeSystemPalette [0x00007FF837757128+539283]
    	QSplashScreen::mousePressEvent [0x000000005707F4BA+247894]
    	main [0x00007FF7E7E334DE+126] (c:\meineprogramme\gitprojects\aktool\main.cpp:17)
    	invoke_main [0x00007FF7E7E72124+52] (f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:75)
    	__scrt_common_main_seh [0x00007FF7E7E71FBE+302] (f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:264)
    	__scrt_common_main [0x00007FF7E7E71E7E+14] (f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:309)
    	mainCRTStartup [0x00007FF7E7E72149+9] (f:\dd\vctools\crt\vcstartup\src\startup\exe_main.cpp:17)
    	BaseThreadInitThunk [0x00007FF85C2A8102+34]
    	RtlUserThreadStart [0x00007FF85E7FC2E4+52]
    
    The program has unexpectedly finished.
    

    The Error Message in Release Mode is:

    [1209/200239:FATAL:navigation_controller_impl.cc(927)] Check failed: active_entry->site_instance() == rfh->GetSiteInstance(). 
    The program has unexpectedly finished.
    

    I know, it is unlikely that someone types only i.e. ftp:// but I know that I sometimes accidently hit the Enter Button. So it should not crash the whole Application. That is complete BS. If it is only a String like 'abc', you get the normal ERR_NAME_NOT_RESOLVED Page.

    The Problem is, that calling the Stop Trigger to Stop loading the Page/Url, is already too late. The if else Checkpoint gets hit, but the Application crashes after that.
    Thanks!


Log in to reply