Page 1 of 1

After playing the game-finished music STK crashes

PostPosted: 03 Jun 2011, 06:01
by acme_pjz
I downloaded the latest SVN code and data yesterday, compiled it, and found something wrong as the title says. If I use the old data without the game-finished music, STK just complains about can't find file, and nothing strange happens. If I use the new data, when game finished the music plays, then STK crashes :| These are messages:

{l Code}: {l Select All Code}
Irrlicht Engine version 1.8.0-alpha
Microsoft Windows XP Professional Service Pack 3 (Build 2600)
Could not load sprite bank because the file does not exist: #DefaultFont
[FileManager] Data files will be fetched from: '.'
Env var LANGUAGE = 'zh_tw', which corresponds to Chinese
[IrrDriver] Creating NULL device
Irrlicht Engine version 1.8.0-alpha
Microsoft Windows XP Professional Service Pack 3 (Build 2600)
Could not load sprite bank because the file does not exist: #DefaultFont
[IrrDriver] Trying OpenGL rendering.
[IrrDriver] Trying to create device with 32 bits
[IrrDriver Temp Logger] Level 3: Could not load sprite bank because the file doe
s not exist: #DefaultFont
startMusic : m_normal_filename=<./data//music/MayDayMayhem.ogg>, gain=0.7
startMusic : m_normal_filename=<./data/music//OnTheRiver.ogg>, gain=0.7
Exception caught : Could not open music XML file
Aborting SuperTuxKart


Is it a bug?

Re: After playing the game-finished music STK crashes

PostPosted: 03 Jun 2011, 06:55
by hiker
acme_pjz {l Wrote}:Is it a bug?

Most likely ;) I just tried, and couldn't reproduce it.

Can you run it in a debugger?
{l Code}: {l Select All Code}
gdb ./supertuxkart
run
# let it crash, then:
where

and post the result here? Or even better: but that in a ticket in trac, assigned to the 0.7.2 milestone.

Cheers,
Joerg

Re: After playing the game-finished music STK crashes

PostPosted: 03 Jun 2011, 13:27
by acme_pjz
Hi,

hiker {l Wrote}:
acme_pjz {l Wrote}:Is it a bug?

Most likely ;) I just tried, and couldn't reproduce it.

Can you run it in a debugger?
{l Code}: {l Select All Code}
gdb ./supertuxkart
run
# let it crash, then:
where

and post the result here? Or even better: but that in a ticket in trac, assigned to the 0.7.2 milestone.

Cheers,
Joerg


I'm using Windows so I don't have GDB but I have Visual Studio ;)

In order to debug it I have to add a breakpoint in music_information.cpp line 67

{l Code}: {l Select All Code}
throw std::runtime_error("Could not open music XML file");


When I won the race, after playing game-finished music it breaks, there is the call stack:

{l Code}: {l Select All Code}
>   supertuxkart.exe!MusicInformation::MusicInformation(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & filename="race_summary.music")  line 67   C++
    supertuxkart.exe!MusicManager::getMusicInformation(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & filename="race_summary.music")  line 196 + 0x26 bytes    C++
    supertuxkart.exe!RaceResultGUI::onUpdate(float dt=0.036000002, irr::video::IVideoDriver * __formal=0x01accc00)  line 392 + 0x26 bytes    C++
    supertuxkart.exe!GUIEngine::render(float elapsed_time=0.036000002)  line 1021   C++
    supertuxkart.exe!IrrDriver::update(float dt=0.036000002)  line 1265 + 0xc bytes    C++
    supertuxkart.exe!MainLoop::run()  line 146   C++
    supertuxkart.exe!main(int argc=1, char * * argv=0x01aa54f8)  line 1076   C++


And I found that in music_information.cpp

{l Code}: {l Select All Code}
    // Otherwise read config file

    // --------------------------

    XMLNode* root = file_manager->createXMLTree(filename);

    if (!root)
    {

        // Don't print a message here - not finding a music file

        // is normal since the file is searched in several different

        // directories (e.g. in data/tracks/XX and data/music).

        throw std::runtime_error("Could not open music XML file");

    }


The variable filename is "race_summary.music", which can found in data/music folder ... but I think there is no exception handler, so the file is not searched in different folders ...

Re: After playing the game-finished music STK crashes

PostPosted: 03 Jun 2011, 13:45
by acme_pjz
I think line 392 in race_result_gui.cpp should change to:

{l Code}: {l Select All Code}
        music_manager->startMusic( music_manager->getMusicInformation( file_manager->getMusicFile("race_summary.music") ) );


(Quick and dirty bug fix :| ) Then it works for me :) ...

Re: After playing the game-finished music STK crashes

PostPosted: 04 Jun 2011, 01:25
by Auria
Should be fixed as of r8811, thanks for the bug report :)