correcting dangling refs / reuse

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31063 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2004-12-19 16:40:18 +00:00
parent 35b92f0530
commit 8dfef0c246

View File

@@ -722,27 +722,21 @@ void wxMacWakeUp()
if ( isSame )
{
#if TARGET_CARBON
// we keep the reference only as a weak ref, to avoid double posting
// wakeups, so no problem if it is stale
static EventRef s_wakeupEvent = 0 ;
if ( s_wakeupEvent )
static wxMacCarbonEvent s_wakeupEvent ;
OSStatus err = noErr ;
if ( !s_wakeupEvent.IsValid() )
{
// is our last wakeup still in the queue
if ( IsEventInQueue( GetMainEventQueue() , s_wakeupEvent ) )
return ;
// has been used already
s_wakeupEvent = 0 ;
err = s_wakeupEvent.Create( 'WXMC', 'WXMC', GetCurrentEventTime(),
kEventAttributeNone ) ;
}
OSStatus err = MacCreateEvent(nil, 'WXMC', 'WXMC', GetCurrentEventTime(),
kEventAttributeNone, &s_wakeupEvent);
if (err == noErr)
if ( err == noErr )
{
if ( IsEventInQueue( GetMainEventQueue() , s_wakeupEvent ) )
return ;
s_wakeupEvent.SetTime(0) ;
err = PostEventToQueue(GetMainEventQueue(), s_wakeupEvent,
kEventPriorityHigh);
ReleaseEvent( s_wakeupEvent ) ;
}
}
#else
PostEvent( nullEvent , 0 ) ;
#endif