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

Crash in Windows when no MIDI device is available and autoconnect is enabled (Segmentation fault) #1446

Open
pedrolcl opened this issue Dec 8, 2024 · 0 comments · May be fixed by #1447
Open
Labels

Comments

@pedrolcl
Copy link
Contributor

pedrolcl commented Dec 8, 2024

FluidSynth version

Build Summary:
FluidSynth Version: 2.4.1
Library version: 3.3.1
Git revision: e604d9e
Build type: Debug
Install Prefix: C:/msys64/home/pedro/fluidsynth3-debug

Describe the bug

When there is not a single MIDI device available on Windows, and the autoconnect MIDI feature is enabled, there is a
crash at startup (Segmentation fault).

Expected behavior

In former versions, there was no crash, but a human readable error message:

$ ./fluidsynth.exe
FluidSynth runtime version 2.4.0
Copyright (C) 2000-2024 Peter Hanappe and others.
Distributed under the LGPL license.
SoundFont(R) is a registered trademark of Creative Technology Ltd.

fluidsynth: error: Device "" does not exists
Failed to create the MIDI thread; no MIDI input
will be available. You can access the synthesizer
through the console.
Type 'help' for help topics.

>

Steps to reproduce

This can be reproduced with Fluidsynth 2.4.1, but also with current master.

  1. Do not connect any MIDI device to the system.
  2. Activate the autoconnect MIDI feature.
  3. Run fluidsynth.exe

Additional context

Autoconnect was enabled using this config file in %PROGRAMDATA%\fluidsynth\fluidsynth.cfg :

set audio.driver wasapi
set audio.period-size 512
set audio.periods 8
set midi.driver winmidi
set midi.autoconnect True
set synth.gain 1.0
set synth.chorus.active False

Here is a GDB sesion that shows the crash location and a back-trace:

$ gdb ./fluidsynth.exe
GNU gdb (GDB) 15.2
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./fluidsynth.exe...
(gdb) run
Starting program: C:\msys64\home\pedro\fluidsynth-git-mingw64\src\fluidsynth.exe
[New Thread 6700.0x30ec]
[New Thread 6700.0xb68]
[New Thread 6700.0x970]
fluidsynth: debug: adding audio.dsound.device=Controlador primario de sonido
fluidsynth: debug: adding audio.dsound.device=GroßeStraßenlautsprecher (HDMI) (2- High Definition Au
dio Device)
fluidsynth: debug: Testing audio device: GroßeStraßenlautsprecher (HDMI)
FluidSynth runtime version 2.4.1
Copyright (C) 2000-2024 Peter Hanappe and others.
Distributed under the LGPL license.
SoundFont(R) is a registered trademark of Creative Technology Ltd.

[New Thread 6700.0x1fb8]
[New Thread 6700.0xfd4]
[New Thread 6700.0x2194]
[New Thread 6700.0x1de0]
[New Thread 6700.0x234]
[New Thread 6700.0x1128]
[New Thread 6700.0x30fc]
fluidsynth: debug: Sample 'Orchestra Hit-2xt': loop range '15942346 - 15947448' after sample end '15
947447', using it anyway
fluidsynth: debug: Using 'winmidi' midi driver

Thread 1 received signal SIGSEGV, Segmentation fault.
fluid_winmidi_autoconnect_build_name (name=0x5ff9c0 "default")
    at C:/msys64/home/pedro/fluidsynth-git/src/drivers/fluid_winmidi.c:501
501         name[n - 1] = 0;
(gdb) bt
#0  fluid_winmidi_autoconnect_build_name (name=0x5ff9c0 "default")
    at C:/msys64/home/pedro/fluidsynth-git/src/drivers/fluid_winmidi.c:501
#1  0x00007ffe711d6813 in new_fluid_winmidi_driver (settings=0x25c7680,
    handler=0x7ff757a63c38 <fluid_midi_router_handle_midi_event>, data=0x25d34d0)
    at C:/msys64/home/pedro/fluidsynth-git/src/drivers/fluid_winmidi.c:543
#2  0x00007ffe7120fb3f in new_fluid_midi_driver (settings=0x25c7680,
    handler=0x7ff757a63c38 <fluid_midi_router_handle_midi_event>, event_handler_data=0x25d34d0)
    at C:/msys64/home/pedro/fluidsynth-git/src/drivers/fluid_mdriver.c:158
#3  0x00007ff757a62ccf in wmain (argc=1, wargv=0x25c74e0)
    at C:/msys64/home/pedro/fluidsynth-git/src/fluidsynth.c:982
#4  0x00007ff757a612ea in __tmainCRTStartup ()
    at C:/M/B/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:260
#5  0x00007ff757a613f6 in mainCRTStartup () at C:/M/B/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:181
(gdb)
@pedrolcl pedrolcl added the bug label Dec 8, 2024
@pedrolcl pedrolcl linked a pull request Dec 8, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant