crash when deleting window in OnUnsplit() corrected

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4590 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-11-16 15:31:40 +00:00
parent 8a729bb860
commit 4419ba31aa

View File

@@ -185,9 +185,9 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
m_dragMode = wxSPLIT_DRAG_DRAGGING; m_dragMode = wxSPLIT_DRAG_DRAGGING;
if ((GetWindowStyleFlag() & wxSP_LIVE_UPDATE) == 0) if ((GetWindowStyleFlag() & wxSP_LIVE_UPDATE) == 0)
{ {
DrawSashTracker(x, y); DrawSashTracker(x, y);
} }
m_oldX = x; m_oldX = x;
m_oldY = y; m_oldY = y;
@@ -202,9 +202,9 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
// Erase old tracker // Erase old tracker
if ((GetWindowStyleFlag() & wxSP_LIVE_UPDATE) == 0) if ((GetWindowStyleFlag() & wxSP_LIVE_UPDATE) == 0)
{ {
DrawSashTracker(m_oldX, m_oldY); DrawSashTracker(m_oldX, m_oldY);
} }
// Obtain window size. We are only interested in the dimension the sash // Obtain window size. We are only interested in the dimension the sash
// splits up // splits up
@@ -304,9 +304,9 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
// Erase old tracker // Erase old tracker
if ((GetWindowStyleFlag() & wxSP_LIVE_UPDATE) == 0) if ((GetWindowStyleFlag() & wxSP_LIVE_UPDATE) == 0)
{ {
DrawSashTracker(m_oldX, m_oldY); DrawSashTracker(m_oldX, m_oldY);
} }
if (m_splitMode == wxSPLIT_VERTICAL) if (m_splitMode == wxSPLIT_VERTICAL)
x = new_sash_position; x = new_sash_position;
@@ -335,14 +335,14 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
// Draw new one // Draw new one
if ((GetWindowStyleFlag() & wxSP_LIVE_UPDATE) == 0) if ((GetWindowStyleFlag() & wxSP_LIVE_UPDATE) == 0)
{ {
DrawSashTracker(m_oldX, m_oldY); DrawSashTracker(m_oldX, m_oldY);
} }
else else
{ {
m_sashPosition = new_sash_position; m_sashPosition = new_sash_position;
m_needUpdating = TRUE; m_needUpdating = TRUE;
} }
} }
else if ( event.LeftDClick() ) else if ( event.LeftDClick() )
{ {
@@ -492,14 +492,14 @@ void wxSplitterWindow::DrawSash(wxDC& dc)
dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.SetPen(*m_lightShadowPen); dc.SetPen(*m_lightShadowPen);
int xShadow = m_borderSize ? m_borderSize - 1 : 0 ; int xShadow = m_borderSize ? m_borderSize - 1 : 0 ;
dc.DrawLine(m_sashPosition, xShadow , m_sashPosition, h-m_borderSize); dc.DrawLine(m_sashPosition, xShadow , m_sashPosition, h-m_borderSize);
dc.SetPen(*m_hilightPen); dc.SetPen(*m_hilightPen);
dc.DrawLine(m_sashPosition+1, m_borderSize - 2, m_sashPosition+1, h - m_borderSize+2); dc.DrawLine(m_sashPosition+1, m_borderSize - 2, m_sashPosition+1, h - m_borderSize+2);
dc.SetPen(*m_mediumShadowPen); dc.SetPen(*m_mediumShadowPen);
int yMedium = m_borderSize ? h-m_borderSize+1 : h ; int yMedium = m_borderSize ? h-m_borderSize+1 : h ;
dc.DrawLine(m_sashPosition+m_sashSize-2, xShadow, m_sashPosition+m_sashSize-2, yMedium); dc.DrawLine(m_sashPosition+m_sashSize-2, xShadow, m_sashPosition+m_sashSize-2, yMedium);
dc.SetPen(*m_darkShadowPen); dc.SetPen(*m_darkShadowPen);
@@ -651,8 +651,8 @@ void wxSplitterWindow::SizeWindows()
} }
} }
wxClientDC dc(this); wxClientDC dc(this);
if ( m_borderSize > 0 ) if ( m_borderSize > 0 )
DrawBorders(dc); DrawBorders(dc);
DrawSash(dc); DrawSash(dc);
} }
@@ -893,8 +893,7 @@ void wxSplitterWindow::OnDoubleClick(wxSplitterEvent& event)
// for compatibility, call the virtual function // for compatibility, call the virtual function
OnDoubleClickSash(event.GetX(), event.GetY()); OnDoubleClickSash(event.GetX(), event.GetY());
if ( GetMinimumPaneSize() == 0 if ( GetMinimumPaneSize() == 0 || m_permitUnsplitAlways )
|| m_permitUnsplitAlways)
{ {
Unsplit(); Unsplit();
} }
@@ -904,8 +903,9 @@ void wxSplitterWindow::OnUnsplitEvent(wxSplitterEvent& event)
{ {
wxWindow *win = event.GetWindowBeingRemoved(); wxWindow *win = event.GetWindowBeingRemoved();
// do it before calling OnUnsplit() which may delete the window
win->Show(FALSE);
// for compatibility, call the virtual function // for compatibility, call the virtual function
OnUnsplit(win); OnUnsplit(win);
win->Show(FALSE);
} }