Skip to content

Commit 6e61142

Browse files
committed
Experimental fix for win 32 timer
1 parent 94ff22a commit 6e61142

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

JuceLibraryCode/modules/juce_core/native/juce_PlatformTimer_windows.cpp

+8-6
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,18 @@ class PlatformTimer final
2929
explicit PlatformTimer (PlatformTimerListener& ptl)
3030
: listener { ptl } {}
3131

32-
void startTimer (int newIntervalMs)
32+
void startTimer(int newIntervalMs)
3333
{
34-
jassert (newIntervalMs > 0);
34+
jassert(newIntervalMs > 0);
3535

36-
const auto callback = [] (UINT, UINT, DWORD_PTR context, DWORD_PTR, DWORD_PTR)
36+
// Define the callback with __stdcall explicitly
37+
static void __stdcall timerCallback(UINT, UINT, DWORD_PTR context, DWORD_PTR, DWORD_PTR)
3738
{
38-
reinterpret_cast<PlatformTimerListener*> (context)->onTimerExpired();
39-
};
39+
reinterpret_cast<PlatformTimerListener*>(context)->onTimerExpired();
40+
}
4041

41-
timerId = timeSetEvent ((UINT) newIntervalMs, 1, callback, (DWORD_PTR) &listener, TIME_PERIODIC | TIME_CALLBACK_FUNCTION);
42+
// Use the explicitly defined callback
43+
timerId = timeSetEvent((UINT)newIntervalMs, 1, timerCallback, (DWORD_PTR)&listener, TIME_PERIODIC | TIME_CALLBACK_FUNCTION);
4244
intervalMs = timerId != 0 ? newIntervalMs : 0;
4345
}
4446

0 commit comments

Comments
 (0)