#include "wx/thread.h"
#ifdef __WXMAC__
-#if TARGET_API_MAC_OSX
+#ifdef __DARWIN__
#include <CoreServices/CoreServices.h>
#else
#include <DriverServices.h>
wxASSERT_MSG( wxThread::IsMain(),
wxT("only main thread may call wxMutexGuiLeaveOrEnter()!") );
+ if( !gs_critsectWaitingForGui )
+ return;
+
wxCriticalSectionLocker enter(*gs_critsectWaitingForGui);
if ( gs_nWaitingForGui == 0 )