From 0a6843648a39774531733b65f1bf592f443e61fe Mon Sep 17 00:00:00 2001 From: tobigun Date: Sat, 25 Oct 2008 10:28:43 +0000 Subject: Music preview is started by the main thread now instead of the SDL timer thread. In the preview function a string is casted to WideString. As the SDL thread does not have a threadvar for an iconv context with FPC on linux (used if cwstring is enabled) the preview crashed formerly. Now we can use cwstring on linux again. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1470 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index 95ccae83..9fc74aae 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -1619,13 +1619,20 @@ begin AudioPlayback.Stop; end; -function MusicPreviewTimerCallback(interval: UInt32; param: Pointer): UInt32; cdecl; +procedure StartMusicPreview(data: Pointer); var ScreenSong: TScreenSong; begin - ScreenSong := TScreenSong(param); + ScreenSong := TScreenSong(data); if (ScreenSong <> nil) then ScreenSong.StartMusicPreview(); +end; + +function MusicPreviewTimerCallback(interval: UInt32; param: Pointer): UInt32; cdecl; +begin + // delegate execution to main-thread + MainThreadExec(@StartMusicPreview, param); + // stop timer Result := 0; end; -- cgit v1.2.3