aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-10-25 10:28:43 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-10-25 10:28:43 +0000
commit0a6843648a39774531733b65f1bf592f443e61fe (patch)
treef5b9faecb758d01a90c50af492c7dbbb3c5a063c /src
parentf0d2b5c1d1e91c70e7e9e0ffd5600bb90a0faf6a (diff)
downloadusdx-0a6843648a39774531733b65f1bf592f443e61fe.tar.gz
usdx-0a6843648a39774531733b65f1bf592f443e61fe.tar.xz
usdx-0a6843648a39774531733b65f1bf592f443e61fe.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/screens/UScreenSong.pas11
1 files changed, 9 insertions, 2 deletions
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;