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