Use two step creation of wxListHeaderWindow to avoid reentrancy under OSX.
This improves the solution of the problem already solved in r74197 by separating setting of m_headerWin variable from the window creation instead of using an explicit recursion check. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74231 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -336,13 +336,16 @@ protected:
|
|||||||
public:
|
public:
|
||||||
wxListHeaderWindow();
|
wxListHeaderWindow();
|
||||||
|
|
||||||
wxListHeaderWindow( wxWindow *win,
|
// We provide only Create(), not the ctor, because we need to create the
|
||||||
wxWindowID id,
|
// C++ object before creating the window, see the explanations in
|
||||||
wxListMainWindow *owner,
|
// CreateOrDestroyHeaderWindowAsNeeded()
|
||||||
const wxPoint &pos = wxDefaultPosition,
|
bool Create( wxWindow *win,
|
||||||
const wxSize &size = wxDefaultSize,
|
wxWindowID id,
|
||||||
long style = 0,
|
wxListMainWindow *owner,
|
||||||
const wxString &name = wxT("wxlistctrlcolumntitles") );
|
const wxPoint &pos = wxDefaultPosition,
|
||||||
|
const wxSize &size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxString &name = wxT("wxlistctrlcolumntitles") );
|
||||||
|
|
||||||
virtual ~wxListHeaderWindow();
|
virtual ~wxListHeaderWindow();
|
||||||
|
|
||||||
|
@@ -952,15 +952,17 @@ wxListHeaderWindow::wxListHeaderWindow()
|
|||||||
m_resizeCursor = NULL;
|
m_resizeCursor = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxListHeaderWindow::wxListHeaderWindow( wxWindow *win,
|
bool wxListHeaderWindow::Create( wxWindow *win,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
wxListMainWindow *owner,
|
wxListMainWindow *owner,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
long style,
|
long style,
|
||||||
const wxString &name )
|
const wxString &name )
|
||||||
: wxWindow( win, id, pos, size, style, name )
|
|
||||||
{
|
{
|
||||||
|
if ( !wxWindow::Create(win, id, pos, size, style, name) )
|
||||||
|
return false;
|
||||||
|
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
m_owner = owner;
|
m_owner = owner;
|
||||||
@@ -978,6 +980,8 @@ wxListHeaderWindow::wxListHeaderWindow( wxWindow *win,
|
|||||||
if (!m_hasFont)
|
if (!m_hasFont)
|
||||||
SetOwnFont( wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT ));
|
SetOwnFont( wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT ));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxListHeaderWindow::~wxListHeaderWindow()
|
wxListHeaderWindow::~wxListHeaderWindow()
|
||||||
@@ -4509,18 +4513,13 @@ void wxGenericListCtrl::CreateOrDestroyHeaderWindowAsNeeded()
|
|||||||
|
|
||||||
if (needs_header)
|
if (needs_header)
|
||||||
{
|
{
|
||||||
// since there is no separate Create method for the wxListHeaderWindow
|
// Notice that we must initialize m_headerWin first, and create the
|
||||||
// we have to guard against reentrancy which happens via new wxListHeaderWindow ->
|
// real window only later, so that the test in the beginning of the
|
||||||
// wxNavigationEnabled::AddChild -> ToggleWindowStyle -> SetWindowStyleFlag
|
// function blocks repeated creation of the header as it could happen
|
||||||
// since has_header is still false then
|
// before via wxNavigationEnabled::AddChild() -> ToggleWindowStyle() ->
|
||||||
static bool blockreentrancy = false;
|
// SetWindowStyleFlag().
|
||||||
|
m_headerWin = new wxListHeaderWindow();
|
||||||
if ( blockreentrancy )
|
m_headerWin->Create
|
||||||
return;
|
|
||||||
|
|
||||||
blockreentrancy = true;
|
|
||||||
|
|
||||||
m_headerWin = new wxListHeaderWindow
|
|
||||||
(
|
(
|
||||||
this, wxID_ANY, m_mainWin,
|
this, wxID_ANY, m_mainWin,
|
||||||
wxPoint(0,0),
|
wxPoint(0,0),
|
||||||
@@ -4531,7 +4530,6 @@ void wxGenericListCtrl::CreateOrDestroyHeaderWindowAsNeeded()
|
|||||||
),
|
),
|
||||||
wxTAB_TRAVERSAL
|
wxTAB_TRAVERSAL
|
||||||
);
|
);
|
||||||
blockreentrancy = false;
|
|
||||||
|
|
||||||
#if defined( __WXMAC__ )
|
#if defined( __WXMAC__ )
|
||||||
static wxFont font( wxOSX_SYSTEM_FONT_SMALL );
|
static wxFont font( wxOSX_SYSTEM_FONT_SMALL );
|
||||||
|
Reference in New Issue
Block a user