From f2bacd5faf13496dc797864e5af2bd27bf372284 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Thu, 2 Jan 2020 13:08:10 +0200 Subject: [PATCH] - fixed crash during enumeration of MIDI devices libraries/zmusic/zmusic/configuration.cpp:109:9: warning: returning reference to local temporary object [-Wreturn-stack-address] --- libraries/zmusic/zmusic/configuration.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/libraries/zmusic/zmusic/configuration.cpp b/libraries/zmusic/zmusic/configuration.cpp index a4ffdd1b2..e83a30317 100644 --- a/libraries/zmusic/zmusic/configuration.cpp +++ b/libraries/zmusic/zmusic/configuration.cpp @@ -97,17 +97,13 @@ int ZMusic_EnumerateMidiDevices() const std::vector &ZMusic_GetMidiDevices() { -#ifdef HAVE_SYSTEM_MIDI - #ifdef __linux__ - auto & sequencer = AlsaSequencer::Get(); - return sequencer.GetDevices(); - #elif _WIN32 - // TODO: move the weird stuff from music_midi_base.cpp here, or at least to this lib and call it here - return {}; - #endif -#else - return {}; -#endif +#if defined HAVE_SYSTEM_MIDI && defined __linux__ + auto &sequencer = AlsaSequencer::Get(); + return sequencer.GetDevices(); +#else // !HAVE_SYSTEM_MIDI || !__linux__ + static std::vector empty; + return empty; +#endif // HAVE_SYSTEM_MIDI && __linux__ }