Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NULL pointer exception at start when using digi_audio instead of digi_mixer #45

Closed
derhass opened this issue Mar 15, 2015 · 2 comments
Closed
Assignees
Milestone

Comments

@derhass
Copy link
Contributor

derhass commented Mar 15, 2015

I just built the latest unification/master head. However, I did build with sdlmixer=no. It turns out the game crashes on startup with:

D1X-Rebirth v0.58.1 0.58.1-d2x-4756-ge1ff8afc Mar 15 2015 15:50:45
This is a MODIFIED version of Descent, based on Registered v1.5 Jan 5, 1996.
Copyright (C) 1994, 1995 Parallax Software Corporation
DESCENT is a trademark of Interplay Productions, Inc.
Copyright (C) 2005-2013 Christian Beckhaeuser
Using plain old SDL audio
terminate called after throwing an instance of 'valbaseptridxutil_t<object const, short>::null_pointer_exception' what(): NULL pointer used

The backtrace is:

0 0x00007ffff686c165 in raise () from /lib/libc.so.6

1 0x00007ffff686ef70 in abort () from /lib/libc.so.6

2 0x00007ffff7093115 in __gnu_cxx::__verbose_terminate_handler ()

at ../../.././libstdc++-v3/libsupc++/vterminate.cc:95

3 0x00007ffff7091176 in __cxxabiv1::__terminate (handler=)

at ../../.././libstdc++-v3/libsupc++/eh_terminate.cc:47

4 0x00007ffff70911c1 in std::terminate () at ../../.././libstdc++-v3/libsupc++/eh_terminate.cc:57

5 0x00007ffff70913d8 in __cxxabiv1::__cxa_throw (obj=0x145d620,

tinfo=0x4d7340 <typeinfo for valbaseptridxutil_t<object const, short>::null_pointer_exception>, dest=
0x429a50 <valbaseptridxutil_t<object const, short>::null_pointer_exception::~null_pointer_exception()>)
at ../../.././libstdc++-v3/libsupc++/eh_throw.cc:87

6 0x0000000000439a30 in check_null_pointer (p=0x0) at common/include/valptridx.h:66

7 vvalptr_t (p=0x0, this=) at common/include/valptridx.h:447

8 vcobjptr_t (this=) at common/main/object.h:433

9 digi_sync_sounds () at similar/main/digiobj.cpp:533

10 0x000000000042069b in digi_audio_set_digi_volume (dvolume=)

at similar/arch/sdl/digi_audio.cpp:301

11 0x000000000042071c in digi_audio_init () at similar/arch/sdl/digi_audio.cpp:193

12 0x0000000000420192 in digi_init () at similar/arch/sdl/digi.cpp:193

13 0x0000000000420d2d in arch_init () at similar/arch/sdl/init.cpp:57

14 0x0000000000465262 in main (argc=, argv=0x7fffffffdd68) at similar/main/inferno.cpp:431

The key problem seem to be that digi_audio_init() calls digi_set_volume(), which in turn calls digi_sync_sound() which finally expects Viewer to point to some valid object, but this is just NULL during initialization.

@vLKp
Copy link
Contributor

vLKp commented Mar 15, 2015

Confirmed. First bad commit is likely 630f119, which caused Viewer to be read whether or not any elements of SoundObjects are in use.

vLKp added a commit that referenced this issue Mar 15, 2015
If a sound is used, it may dereference Viewer.  If Viewer is null, this
will crash.  In 630f119,
digi_sync_sounds changed to assume Viewer is valid.  This crashes during
early startup when not using the SDL_mixer backend, even though no
sounds are in use.

Reported-by: derhass <#45>
Fixes: 630f119 ("Cache Viewer in digiobj")
@vLKp
Copy link
Contributor

vLKp commented Mar 15, 2015

Fixed by 2458078.

@vLKp vLKp closed this as completed Mar 15, 2015
@vLKp vLKp self-assigned this Sep 22, 2015
@vLKp vLKp added this to the 0.60 milestone Sep 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants