That is what I thought. On initial start up Sigil expects a certain order for things so that geometry is set first, the restore state is done next when the Main Application is first shown. And in between those 2 things happening either a new empty epub is created or an epub is loaded.
Using Full Screen and Maximized changes this order a bit since showMaximized() and showFullScreen() force a show earlier (a MainWindow Activation).
But before the very first MainWindow can be shown either CreateNewBook() must be run (to create an empty epub) or an actual epub must be fully loaded, otherwise the MainWindow TabManager will crash if it has no tabs at all.
But the exceptions started to interfere with that order because when showing the exception Error Dialog and waiting for okay to be pushed, it both delayed the running of CreateNewBook() (because the loading of a epub failed) and allowed other QEvents to be processed resulting in the MainWindow being activated before an epub (empty or real) existed.
My last update to MainWindow.cpp makes CreateNewBook() be called as soon as any Exception is thrown when trying to load an epub so that showing the ErrorDialog can run and other QEvents can be processed and not cause a problem.
At least that is my current working theory. And @DNSB's testing seems to support that theory but your testing is showing something else is happening related to Maximized windows.
So one step forward and one step back all at the same time!
What we really need is to generate a backtrace easily on Windows like we get automatically with MacOS and can easily get with gdb on Linux so we can see the exact sequence of events happening.
Last edited by KevinH; 09-03-2024 at 11:38 PM.
|