[hatari-devel] Crossbar_Reset / Portaudio segfaults Hatari

Eero Tamminen eerot at users.berlios.de
Tue Mar 16 22:26:22 CET 2010


Hi,

When using CMake compiled (i.e. -O3, asserts off, apprarently some
differences in what it defines) Hatari version, it crashes at reboot.
This is the Valgrind output from the crash:

Expression '*idev = open( idevName, flags )' failed 
in 'src/hostapi/oss/pa_unix_oss.c', line: 810
Expression 'OpenDevices( idevName, odevName, &idev, &odev )' failed 
in 'src/hostapi/oss/pa_unix_oss.c', line: 864
==6333==
==6333== Invalid read of size 4
==6333==    at 0x405BA5B: (within /usr/lib/libportaudio.so.2.0.0)
==6333==    by 0x4049C46: Pa_OpenStream (in /usr/lib/libportaudio.so.2.0.0)
==6333==    by 0x81792A7: Microphone_Start (microphone.c:110)
==6333==    by 0x817908E: Crossbar_Reset (crossbar.c:363)
==6333==    by 0x8072282: Reset_ST (reset.c:65)
==6333==    by 0x8052B94: Change_CopyChangedParamsToConfiguration 
(change.c:334)
==6333==    by 0x80549FA: Dialog_DoProperty (dialog.c:68)
==6333==    by 0x80788E4: ShortCut_ActKey (shortcut.c:259)
==6333==    by 0x807E74D: Video_InterruptHandler_VBL (video.c:2588)
==6333==    by 0x8087D38: m68k_go (newcpu.c:1754)
==6333==    by 0x806BF03: M68000_Start (m68000.c:228)
==6333==    by 0x806CA3D: main (main.c:677)
==6333==  Address 0x1c is not stack'd, malloc'd or (recently) free'd


I think the problem is in Crossbar_Reset().  It does:
------
        crossbar.microphone_ADC_is_started = 0;
...
        /* Start Microphone jack emulation */
        if (crossbar.microphone_ADC_is_started == 0) {
                crossbar.microphone_ADC_is_started = 
Microphone_Start((int)nAudioFrequency);
        }
-----

I think "crossbar.microphone_ADC_is_started = 0" should be removed.
Maybe Microphone_Stop() (with suitable checks for what was initialized)
should also be called if initialization fails?


	- Eero



More information about the hatari-devel mailing list