From 317f58fa318450265b18657ce94c7224cae4c870 Mon Sep 17 00:00:00 2001 From: crumblingstatue Date: Thu, 22 Jul 2021 21:48:39 +0200 Subject: [PATCH] Make sure CallbackStream doesn't get destroyed before the Music Music's destructor call's stop(), which in turn calls onSeek. For CSFML, this requires the CallbackStream to stay alive until that point. In C++, destructors for fields are called in reverse declaration order. We swap the order of the fields, putting the Music after the CallbackStream, so it gets destroyed before it. --- src/SFML/Audio/MusicStruct.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SFML/Audio/MusicStruct.h b/src/SFML/Audio/MusicStruct.h index fbfe98a..ae78f3e 100644 --- a/src/SFML/Audio/MusicStruct.h +++ b/src/SFML/Audio/MusicStruct.h @@ -37,8 +37,8 @@ //////////////////////////////////////////////////////////// struct sfMusic { - sf::Music This; CallbackStream Stream; + sf::Music This; };