View Single Post
Old 08-18-2024, 02:14 PM   #36
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,961
Karma: 6361444
Join Date: Nov 2009
Device: many
Quote:
Originally Posted by Doitsu View Post
I noticed a cosmetic issue with the Windows version. I'm getting the not well-formed message twice if an epub is missing a doctype. I've attached a simple test case.
(The Mend ... Source Code on Open/Save options were deactivated.)

This must be a Windows only bug.

With Mend on Open set, I get just one warning that said it was already fixed.

If I turn off Mend On Open, then all I get is one message that says I need to run Mend myself or fix things manually.

No double warnings at all.

In fact the ShowLastOpenFileWarnings() routine only shows a warning dialog if warnings exist and after showing then m_LastOpenFileWarnings is cleared.

Code:
void MainWindow::ShowLastOpenFileWarnings()
{
    if (!m_LastOpenFileWarnings.isEmpty()) {
        foreach(QString info, m_LastOpenFileWarnings) {
            QString msg;
            QString details;
            if (!info.isEmpty()) {
                QStringList warning = info.split(QChar(31));
                msg = warning[0];
                details = warning[1];
                Utility::DisplayStdWarningDialog( 
                "<p><b>" %
                tr("Warning: ") % msg %
                "</b><p>", details, this);
            }
        }
        m_LastOpenFileWarnings.clear();
    }
}
The first place it loads the warnings and then tries to show them depending on if initial load is done or not (depending on if MainWindow as open and active and ready to show the Warnings dialog).

Code:
             // Get any warnings - if our main window is not currently visible they will be
            // shown when the window is displayed.
            m_LastOpenFileWarnings.append(importer->GetLoadWarnings());
            if (!m_IsInitialLoad) {
                ShowLastOpenFileWarnings();
            }
And the second is where it is delayed to if the MainWindow was not already open and ready in the first try.

Code:
            if (m_FirstTime && !m_LastOpenFileWarnings.isEmpty()) {
                QTimer::singleShot(0, this, SLOT(ShowLastOpenFileWarnings()));
            }
But in both places they are cleared once shown, so I have no idea how it can show them twice unless somehow things are running in a multi-threaded way.

There should only be one thread that runs the gui and either it showed or did not show the warnings.

So something is strange or there are alternate paths through the code I am not seeing.
KevinH is offline   Reply With Quote