From: Stefan Csomor Date: Thu, 13 Jun 2013 00:38:54 +0000 (+0000) Subject: fixing reentrancy which happened in tests, bringing client coordinates origins in... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/246f5005fbe98aa8a675bad438a4246c894cd794 fixing reentrancy which happened in tests, bringing client coordinates origins in synch git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74197 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 54f7f0dd57..bf9448a331 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -4509,6 +4509,17 @@ void wxGenericListCtrl::CreateOrDestroyHeaderWindowAsNeeded() if (needs_header) { + // since there is no separate Create method for the wxListHeaderWindow + // we have to guard against reentrancy which happens via new wxListHeaderWindow -> + // wxNavigationEnabled::AddChild -> ToggleWindowStyle -> SetWindowStyleFlag + // since has_header is still false then + static bool blockreentrancy = false; + + if ( blockreentrancy ) + return; + + blockreentrancy = true; + m_headerWin = new wxListHeaderWindow ( this, wxID_ANY, m_mainWin, @@ -4520,7 +4531,8 @@ void wxGenericListCtrl::CreateOrDestroyHeaderWindowAsNeeded() ), wxTAB_TRAVERSAL ); - + blockreentrancy = false; + #if defined( __WXMAC__ ) static wxFont font( wxOSX_SYSTEM_FONT_SMALL ); m_headerWin->SetFont( font ); @@ -5291,21 +5303,29 @@ bool wxGenericListCtrl::DoPopupMenu( wxMenu *menu, int x, int y ) void wxGenericListCtrl::DoClientToScreen( int *x, int *y ) const { + // having (0,0) at the origin of the m_mainWin seems wrong compared to + // the other code like in Refresh +#if 0 // It's not clear whether this can be called before m_mainWin is created // but it seems better to be on the safe side and check. if ( m_mainWin ) m_mainWin->DoClientToScreen(x, y); else +#endif wxListCtrlBase::DoClientToScreen(x, y); } void wxGenericListCtrl::DoScreenToClient( int *x, int *y ) const { + // having (0,0) at the origin of the m_mainWin seems wrong compared to + // the other code like in Refresh +#if 0 // At least in wxGTK/Univ build this method can be called before m_mainWin // is created so avoid crashes in this case. if ( m_mainWin ) m_mainWin->DoScreenToClient(x, y); else +#endif wxListCtrlBase::DoScreenToClient(x, y); }