[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-commits] Commit Complete
Commit by : luke
Repository : xara
Revision : 879
Date : Tue Apr 25 11:11:28 BST 2006
Changed paths:
M /Trunk/XaraLX/wxOil/camelot.cpp
Protect ourseleves against a NULL focus window, should only happen under debug but makes for more robust code
Diff:
Index: Trunk/XaraLX/wxOil/camelot.cpp
===================================================================
--- Trunk/XaraLX/wxOil/camelot.cpp (revision 878)
+++ Trunk/XaraLX/wxOil/camelot.cpp (revision 879)
@@ -209,9 +209,12 @@
void CCamApp::OnKeyEvent( wxKeyEvent &event )
{
// If a control (but not a button) has focus, let it handle the key events
- wxClassInfo* pClassInfo = wxWindow::FindFocus()->GetClassInfo();
+ // Whilst debugging focus can end-up NULL, so we protect ourselves
+ wxWindow* pFocusWnd = wxWindow::FindFocus();
+ wxClassInfo* pClassInfo = NULL != pFocusWnd ? pFocusWnd->GetClassInfo() : NULL;
TRACEUSER( "luke", _T("Focus = %s
"), pClassInfo->GetClassName() );
- if( pClassInfo->IsKindOf( CLASSINFO(wxControl) ) &&
+ if( NULL != pFocusWnd &&
+ pClassInfo->IsKindOf( CLASSINFO(wxControl) ) &&
!pClassInfo->IsKindOf( CLASSINFO(wxButton) ) &&
!pClassInfo->IsKindOf( CLASSINFO(wxSlider) ) &&
!pClassInfo->IsKindOf( CLASSINFO(wxCamArtControl) ) )
Xara