diff --git a/build/macosx/platform_specific_code/juce_mac_MessageManager.mm b/build/macosx/platform_specific_code/juce_mac_MessageManager.mm index 3194ee910b..413f4c0601 100644 --- a/build/macosx/platform_specific_code/juce_mac_MessageManager.mm +++ b/build/macosx/platform_specific_code/juce_mac_MessageManager.mm @@ -217,12 +217,19 @@ using namespace JUCE_NAMESPACE; - (void) performCallback: (id) info { - CallbackMessagePayload* pl = (CallbackMessagePayload*) info; + if ([info isKindOfClass: [NSData class]]) + { + CallbackMessagePayload* pl = (CallbackMessagePayload*) [((NSData*) info) bytes]; - if (pl != 0) + if (pl != 0) + { + pl->result = (*pl->function) (pl->parameter); + pl->hasBeenExecuted = true; + } + } + else { - pl->result = (*pl->function) (pl->parameter); - pl->hasBeenExecuted = true; + jassertfalse // should never get here! } } @@ -322,6 +329,8 @@ void* MessageManager::callFunctionOnMessageThread (MessageCallbackFunction* call } else { + const ScopedAutoReleasePool pool; + CallbackMessagePayload cmp; cmp.function = callback; cmp.parameter = data; @@ -329,7 +338,8 @@ void* MessageManager::callFunctionOnMessageThread (MessageCallbackFunction* call cmp.hasBeenExecuted = false; [juceAppDelegate performSelectorOnMainThread: @selector (performCallback:) - withObject: (id) &cmp + withObject: [NSData dataWithBytesNoCopy: &cmp + length: sizeof (cmp)] waitUntilDone: YES]; return cmp.result; diff --git a/build/win32/platform_specific_code/juce_win32_Threads.cpp b/build/win32/platform_specific_code/juce_win32_Threads.cpp index 953f97f350..7787f448cd 100644 --- a/build/win32/platform_specific_code/juce_win32_Threads.cpp +++ b/build/win32/platform_specific_code/juce_win32_Threads.cpp @@ -170,7 +170,7 @@ void juce_setCurrentThreadName (const String& name) throw() Thread::ThreadID Thread::getCurrentThreadId() throw() { - return (ThreadID) GetCurrentThreadId(); + return (ThreadID) (pointer_sized_int) GetCurrentThreadId(); } // priority 1 to 10 where 5=normal, 1=low diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index 0bb12db69c..f2ec0de54b 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -239382,7 +239382,7 @@ void juce_setCurrentThreadName (const String& name) throw() Thread::ThreadID Thread::getCurrentThreadId() throw() { - return (ThreadID) GetCurrentThreadId(); + return (ThreadID) (pointer_sized_int) GetCurrentThreadId(); } // priority 1 to 10 where 5=normal, 1=low