Opened 4 days ago

Last modified 4 days ago

#12930 new defect

NEVERHOOD: Game can crash on exit (both demo and full game)

Reported by: eriktorbjorn Owned by:
Priority: normal Component: Engine: Neverhood
Version: Keywords:
Cc: Game: The Neverhood

Description

If I walk around outside near the monster cave in the big demo, pressing Esc causes the game to segfault. This is what the backtrace shows:

#0  0x00005555578fe585 in Neverhood::SoundItem::setPlayOnceAfterCountdown(bool)
    (this=0x0, playOnceAfterCountdown=false) at ./engines/neverhood/sound.h:110
#1  0x00005555578fca63 in Neverhood::SoundMan::setSoundThreePlayFlag(bool)
    (this=0x55555cbc33d0, playOnceAfterCountdown=false)
    at engines/neverhood/sound.cpp:490
#2  0x00005555579919ae in Neverhood::NavigationScene::~NavigationScene()
    (this=0x55555cca6920, __in_chrg=<optimized out>)
    at engines/neverhood/navigationscene.cpp:62
#3  0x00005555579919d6 in Neverhood::NavigationScene::~NavigationScene()
    (this=0x55555cca6920, __in_chrg=<optimized out>)
    at engines/neverhood/navigationscene.cpp:63
#4  0x0000555557916d6b in Neverhood::Module::~Module()
    (this=0x55555c7eae80, __in_chrg=<optimized out>)
    at engines/neverhood/module_scene.cpp:40
#5  0x000055555796e31c in Neverhood::Module2600::~Module2600()
    (this=0x55555c7eae80, __in_chrg=<optimized out>)
    at engines/neverhood/modules/module2600.cpp:53
#6  0x000055555796e338 in Neverhood::Module2600::~Module2600()
    (this=0x55555c7eae80, __in_chrg=<optimized out>)
    at engines/neverhood/modules/module2600.cpp:55
#7  0x000055555790c0e5 in Neverhood::GameModule::~GameModule()
    (this=0x55555c80d7b0, __in_chrg=<optimized out>)
    at engines/neverhood/gamemodule.cpp:88
#8  0x000055555790c11c in Neverhood::GameModule::~GameModule()
    (this=0x55555c80d7b0, __in_chrg=<optimized out>)
    at engines/neverhood/gamemodule.cpp:90
#9  0x00005555578f57d2 in Neverhood::NeverhoodEngine::run() (this=
    0x55555cda32d0) at engines/neverhood/neverhood.cpp:135
#10 0x0000555555d64817 in runGame(Plugin const*, Plugin const*, OSystem&, Common::String const&)
    (plugin=0x55555bbe31f0, enginePlugin=0x55555ba56960, system=..., debugLevels=...) at base/main.cpp:311
#11 0x0000555555d66100 in scummvm_main(int, char const* const*)
    (argc=1, argv=0x7fffffffe678) at base/main.cpp:621
#12 0x0000555555d61d27 in main(int, char**) (argc=1, argv=0x7fffffffe678)
    at backends/platform/sdl/posix/posix-main.cpp:45

I'm guessing this is because in the demos, pressing Esc calls _vm->quitGame(). See GameModule::handleEscapeKey()

I'm guessing that the engine needs to be properly shut down.

Attachments (1)

neverhood-demo.002 (17.0 KB ) - added by eriktorbjorn 4 days ago.

Download all attachments as: .zip

Change History (4)

by eriktorbjorn, 4 days ago

Attachment: neverhood-demo.002 added

comment:1 by eriktorbjorn, 4 days ago

I can also get the full game to crash there, if I use the Ctrl+F5 menu to quit the game.

comment:2 by eriktorbjorn, 4 days ago

It seems that when _gameModule is deleted, it will delete some sounds from the sound module.

Perhaps something like this would work? I'm not sure if it's the correct approach, though.

diff --git a/engines/neverhood/sound.cpp b/engines/neverhood/sound.cpp
index db22b72289..eb55fde45c 100644
--- a/engines/neverhood/sound.cpp
+++ b/engines/neverhood/sound.cpp
@@ -421,6 +421,11 @@ void SoundMan::deleteSoundGroup(uint32 groupNameHash) {
                _soundIndex2 = -1;
        }
 
+       if (_soundIndex3 != -1 && _soundItems[_soundIndex3]->getGroupNameHash() == groupNameHash) {
+               deleteSoundByIndex(_soundIndex3);
+               _soundIndex3 = -1;
+       }
+
        for (uint index = 0; index < _soundItems.size(); ++index)
                if (_soundItems[index] && _soundItems[index]->getGroupNameHash() == groupNameHash)
                        deleteSoundByIndex(index);

It would be consistent with how it handles _soundIndex1 and _soundIndex2, but...

comment:3 by eriktorbjorn, 4 days ago

Summary: NEVERHOOD: Demo can crash when pressing EscNEVERHOOD: Game can crash on exit (both demo and full game)
Note: See TracTickets for help on using tickets.