ErikCumps / spwproject

The SP:WaW and winSPWW2 savegame inspection and campaign tracking project.
GNU General Public License v2.0
5 stars 0 forks source link

QT-WARNING #20

Open Philip0s opened 4 months ago

Philip0s commented 4 months ago

Hi Eric on a fresh install of the 0.8.4 at the 1st launch i can enter the parameter of the SPWAW game i want to use (nothing red) but then your tool just crash and close. the reason seems to be: 14873 08:12:39.472 [0x00003510] Qt has caught an exception thrown from an event handler. Throwing exceptions from an event handler is not supported in Qt. You must reimplement QApplication::notify() and catch all exceptions there.

When you'll have the time to have a look ;)

Regards. Phil

Philip0s commented 3 months ago

Maybe a clue, if on a new install I disable the "autoload" option it works fine. The problem seems to be the "dossier autoload" by default at the 1st launch, if there is nothing to load the tool crash. If after creating a dossier I go in the preferences to enable the autoload and close the tool, then I can run it without any issue.

ErikCumps commented 3 months ago

When Warcab's autoload option is set, it will automatically try open the last used dossier file when it starts up.

Note: the dossier file is a Warcab file, it is not a savegame from SPWaW.

It is not a problem if there is no last used dossier file in its settings (i.e. an empty string), or if the specified dossier file no longer exists. In that case Warcab will just continue with an empty dossier.

But this is not what happened in this case.

Warcab did try to load a dossier file, but it encountered a problem with the file which caused it to crash.

We can see this in the debug_console.log file. Notice how the progress bar during the dossier load moves from 10 -> 20 -> 33, but it crashes before it reaches 100:

             172 11:33:16.133 [0x00002b50] GUI: finishing splash screen
             823 11:33:16.133 [0x00002b50] GUI: posting initialization event
              98 11:33:16.133 [0x00002b50] GUI: starting event loop
            1275 11:33:16.133 [0x00002b50] GUI: finalizing initial WARCAB state
             461 11:33:16.133 [0x00002b50] [WARCABState::load] starting progress
                 ...
             126 11:33:16.179 [0x00002b50] [GuiProgress::inc] 0 <= v:10 <= 100
                 ...
           22380 11:33:16.195 [0x00002b50] [GuiProgress::set] 0 <= v:21 <= 100
                 ...
           27509 11:33:16.226 [0x00002b50] [GuiProgress::set] 0 <= v:33 <= 100
                 ...
           14051 11:33:16.242 [0x00002b50] <QT-WARNING> Qt has caught an exception thrown from an
event handler. Throwing exceptions from an event handler is not supported in Qt. You must
reimplement QApplication::notify() and catch all exceptions there.

Please note: the QT-WARNING QApplication::notify here is just a symptom, it's not the root cause. The dossier file caused Warcab to throw an exception, but it does not catch this (allowing it to crash). I agree this could be improved, but this is just a cosmetic change, it will not solve the issue.

Root cause of the crash:

There seems to be something wrong with the dossier file, but it is hard to tell what. There is no real clue in the SPWAWLIB.log file, it only shows that it crashes somewhere after loading the battle turn data of the first battle in the dossier file, because the log file stops unexpectedly at that point:

----------------------------------------------------------------------
         0 11:33:16.195 [dossier_load_battles] dst->blen=4
     27241 11:33:16.226 i=00, p->bdate=1939/10/21 20:00<B>65535, p->tcnt=4

This could be a corruption in the dossier file itself, or it could be an incompatibility between the older version 0.6.3 (that created the dossier file) and the new version 0.8.4, or it could be a bug in 0.8.4.

To investigate this further, I would need a copy of that dossier file so that I can try to reproduce and debug the issue myself.

debug_console.log SPWAWLIB.log