don't access the window after it had been deleted by the focus event handler (patch 1693063)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45294 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-04-07 11:39:44 +00:00
parent 557844d031
commit 6a74af89fc
2 changed files with 12 additions and 11 deletions

View File

@@ -1880,12 +1880,14 @@ gtk_window_focus_out_callback( GtkWidget *widget,
}
#endif // wxUSE_CARET
gboolean ret = FALSE;
// don't send the window a kill focus event if it thinks that it doesn't
// have focus already
if ( win->m_hasFocus )
{
// the event handler might delete the window when it loses focus, so
// check whether this is a custom window before calling it
const bool has_wxwindow = win->m_wxwindow != NULL;
win->m_hasFocus = false;
wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() );
@@ -1893,14 +1895,13 @@ gtk_window_focus_out_callback( GtkWidget *widget,
(void)win->GTKProcessEvent( event );
ret = TRUE;
}
// Disable default focus handling for custom windows
// since the default GTK+ handler issues a repaint
if (win->m_wxwindow)
return ret;
if ( has_wxwindow )
return TRUE;
}
// continue with normal processing
return FALSE;
}

View File

@@ -334,6 +334,9 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
}
#endif
if ( thisWindow->MacIsUserPane() )
result = noErr ;
if ( controlPart == kControlFocusNoPart )
{
#if wxUSE_CARET
@@ -367,9 +370,6 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
event.SetEventObject(thisWindow);
thisWindow->GetEventHandler()->ProcessEvent(event) ;
}
if ( thisWindow->MacIsUserPane() )
result = noErr ;
}
break ;