Avoid crashes in wxGenericListCtrl client<->screen conversion code.
At least in wxUniv build, DoScreenToClient() can be called before the main control window is created which results in a crash when attempting to forward to its DoScreenToClient() version. Check for m_mainWin being non-NULL before using it to at least avoid the crash, even if it's not really clear whether this is a 100% correct fix. Closes #12390. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65831 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -5061,12 +5061,22 @@ bool wxGenericListCtrl::DoPopupMenu( wxMenu *menu, int x, int y )
|
||||
|
||||
void wxGenericListCtrl::DoClientToScreen( int *x, int *y ) const
|
||||
{
|
||||
m_mainWin->DoClientToScreen(x, y);
|
||||
// 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
|
||||
wxControl::DoClientToScreen(x, y);
|
||||
}
|
||||
|
||||
void wxGenericListCtrl::DoScreenToClient( int *x, int *y ) const
|
||||
{
|
||||
m_mainWin->DoScreenToClient(x, y);
|
||||
// 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
|
||||
wxControl::DoScreenToClient(x, y);
|
||||
}
|
||||
|
||||
void wxGenericListCtrl::SetFocus()
|
||||
|
Reference in New Issue
Block a user