Opened 11 years ago

Closed 8 years ago

#3241 closed bug (fixed)

Lights Off crashes on startup

Reported by: darkwyrm Owned by: nobody
Priority: normal Milestone: R1
Component: Kits/Media Kit Version: R1/pre-alpha1
Keywords: Cc: leavengood@…
Blocked By: Blocking:
Platform: All

Description (last modified by korli)

As of hrev28815, the version on Bebits crashes immediately after starting up.

#0  0x0061fdf7 in BMediaTrack::ReadFrames ()
   from /boot/beos/system/lib/
#1  0x0061fdd2 in BMediaTrack::ReadFrames ()
   from /boot/beos/system/lib/
#2  0x00498c16 in BFileGameSound::Load () from /boot/beos/system/lib/
#3  0x00498409 in BFileGameSound::Preload ()
   from /boot/beos/system/lib/
#4  0x0020cd49 in GridView::StartupPreferences ()
#5  0x00209dce in GridView::GridView ()
#6  0x0020d1e8 in MainWindow::MainWindow ()
#7  0x00208eb2 in MyApp::MyApp ()
#8  0x00208fb5 in main ()

Attachments (2)

Haiku_logo_seen_in_LightsOff.png (33.2 KB ) - added by leavengood 11 years ago.
Drawing glitch seen in between the "light" buttons.
Lights_Out_Debug_Output.txt (2.6 KB ) - added by jscipione 9 years ago.
Debug output generated by running Lights Off in Haiku hrev42455 after starting up and clicking some blocks.

Download all attachments as: .zip

Change History (17)

comment:1 by korli, 11 years ago

Description: modified (diff)

by leavengood, 11 years ago

Drawing glitch seen in between the "light" buttons.

comment:2 by leavengood, 11 years ago

So I was just trying to debug this issue and I discovered that if you run LightsOff from the Terminal the crash does not happen. Though there is a lot of debugging information printed (probably because I enabled DEBUG for Though the same debug build of seems to choke up GDB when I try to run LightsOff from Tracker and the crash happens :(

It seems very strange that there is a crash when running from Tracker and no such thing when running from Terminal.

Also there are some drawing gliches: the areas between the "light buttons" are not painted over properly so whatever was drawn previously whereever LightsOff appears is seen in those lines, including the desktop. See attached screenshot where the Haiku logo and desktop color can be seen in those lines. Not sure if this is a Haiku issue or some problem in the LightsOff code.

comment:3 by leavengood, 11 years ago

Cc: leavengood@… added

comment:4 by pulkomandy, 9 years ago

The program load sounds this way :

	BEntry entry("click.wav");

This will work from terminal, but not when started from tracker, likely because the path is not relative to the app directory in that case ?

The program will blindly continue, and crash when it tries to actually open the file. Does it work under BeOS ? and does it have sound when run from tracker ?

We may avoid the crash when given a broken entry ref, that's better than nothing.

Note the crash will happen if running the app through our Debugger.

comment:5 by axeld, 9 years ago

As in BeOS, Haiku applications will inherit the path from its parent. When you launch an application from Tracker, its path will be /boot/home IIRC, as that's what Tracker is using.

It would be interesting where it actually crashes, though, since that might very well be solvable (for example if it uses the Game Kit support classes it probably don't need to load the file itself).

comment:6 by pulkomandy, 9 years ago

Yes, the stacktrace is in the original ticket already. Not sure where an error shoud have been raised, but basically we get an (invalid) entry_ref from the BEntry, then build a BFileGameSound from that, and this create a BMediaTrack. All of this works fine (wel the app doesn't seem to do much error checking at least) and, when we try to actually load the file, there's a crash as seen above.

comment:7 by marcusoverhagen, 9 years ago

GridView does no error checking for BEntry and BFileGameSound it creates, and calls Preload() on them.

Preload() calls Load()

BFileGameSound::Load() calls BMediaTrack::ReadFrames() with fAudioStream->stream invalid pointer.

When a file doesn't exist, fAudioStream->stream is invalid after BFileGameSound::Init(). This Init() has some more issues as well.

Solution: fix all the bugs. There are sooo many. Quick solution: Set fAudioStream to NULL on init error, and check it in Load()

Last edited 9 years ago by marcusoverhagen (previous) (diff)

comment:8 by marcusoverhagen, 9 years ago

Owner: changed from marcusoverhagen to nobody
Status: newassigned

comment:9 by darkwyrm, 9 years ago

I had a look at the GridView code and I must say that I'm not proud of it -- it was quickly written, so I'm not surprised that the code doesn't do much error checking. However, the crashes are not caused by NULL pointers in the regular program code, which my local code now checks for. The pointers in StartupPreferences are valid. My initial reason for even filing the bug was because Lights Off worked just fine under R5 and Zeta but crashed in Haiku and, not knowing anything about the Media Kit, I couldn't figure out the specific problem(s).

comment:10 by marcusoverhagen, 9 years ago

Does it still crash with hrev42453?

comment:11 by jscipione, 9 years ago

I tested Lights Off in BeOS R5.03PE Max Ed v4b1 in vmware. When I run the application from Tracker no sound plays, nor does the Game->How To Play menu option work (which is suppose to open up an html file found in the app directory.) However, there is no crash and no drawing glitches. If I run the app from the terminal the sound works and the Game->How To Play menu option works as well. So what pulkomandy said about relative paths is most likely correct.

Last edited 9 years ago by jscipione (previous) (diff)

comment:12 by jscipione, 9 years ago

I also tested Lights Off in Haiku hrev42455 in Virtual Box. I started the app from Tracker and the application runs, it does not crash. Graphical glitches, however, remain as reported. Neither the sound files play nor does the Game->How To Play menu option work.

I then started the application from the Terminal and the graphical glitches remain but the sound files play and the Game->How To Play menu option works. So, this functionality is identical to BeOS 5.

So the only real bug that remains in Haiku are the graphical glitches. I will attach a file out the debug output I get for Lights Out in Terminal.

by jscipione, 9 years ago

Attachment: Lights_Out_Debug_Output.txt added

Debug output generated by running Lights Off in Haiku hrev42455 after starting up and clicking some blocks.

comment:13 by mmu_man, 9 years ago

Actually, I'm not sure the crash is fixed. At least I do have a similar stack crawl on a pure virtual exception in Sounds sometimes, as I tried to reproduce #3085...

comment:14 by mmu_man, 9 years ago

Using some objdump -D I traced the pure virtual to this call in BMediaTrack::ReadFrames(): result = fDecoder->Decode(buffer, _frameCount, _header, info); Maybe the decoder is being deleted at the same time and already has executed part of the dtor, putting the vtable in an odd state ?

comment:15 by pulkomandy, 8 years ago

Resolution: fixed
Status: assignedclosed

This particular bug is fixed.

Please open a new one for the graphical glitches.

mmu_man: there are other bugs in the Media Kit. I'm going to fix what may be a variant of what you see. see you in #4893 :)

Note: See TracTickets for help on using tickets.