View Single Post
Old 09-06-2019, 10:10 AM   #18
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,928
Karma: 6361444
Join Date: Nov 2009
Device: many
Here is what I added to UpdatePage() which gets invoked when you press on a navigation icon or use the navigation menu itself. Please note, this is only a partial fix:

Code:
    try {
        text = Utility::ReadUnicodeTextFile(filename_url);
    } catch (std::exception &e) {
        Utility::DisplayStdErrorDialog(tr("File load failed"), e.what());
        text = "<html><head><title></title></head><body><h1>" + tr("File Load Failed") + "</h1></body></html>";
        file_path = "";
        m_CurrentFilePath = "";
    }
because between the time we check that the xhtml file still exists and then attempt to load QtWebEngine with the page, any of the separate file resources (external images, styles, fonts, etc) could be deleted causing a load deep inside Qt webengine to possibly hang or worse crash.

Even if I parsed the entire xhtml file to find and build links to every external resource, and checked if they still exist, since file loading is not an atomic operations, the actual timing of the delete will always be an issue.
KevinH is offline   Reply With Quote