Call wxAuiManager::UnInit() if associated frame is destroyed
Don't require the application code to explicitly do it if the frame is destroyed before the manager itself.
This commit is contained in:
committed by
Vadim Zeitlin
parent
2ea7090de2
commit
f646532889
@@ -555,6 +555,7 @@ public:
|
||||
protected:
|
||||
|
||||
// protected events
|
||||
void OnDestroy(wxWindowDestroyEvent& evt);
|
||||
void OnPaint(wxPaintEvent& evt);
|
||||
void OnEraseBackground(wxEraseEvent& evt);
|
||||
void OnSize(wxSizeEvent& evt);
|
||||
|
@@ -593,6 +593,7 @@ bool wxAuiPaneInfo::IsValid() const
|
||||
wxBEGIN_EVENT_TABLE(wxAuiManager, wxEvtHandler)
|
||||
EVT_AUI_PANE_BUTTON(wxAuiManager::OnPaneButton)
|
||||
EVT_AUI_RENDER(wxAuiManager::OnRender)
|
||||
EVT_WINDOW_DESTROY(wxAuiManager::OnDestroy)
|
||||
EVT_PAINT(wxAuiManager::OnPaint)
|
||||
EVT_ERASE_BACKGROUND(wxAuiManager::OnEraseBackground)
|
||||
EVT_SIZE(wxAuiManager::OnSize)
|
||||
@@ -914,6 +915,8 @@ void wxAuiManager::SetManagedWindow(wxWindow* wnd)
|
||||
{
|
||||
wxASSERT_MSG(wnd, wxT("specified window must be non-NULL"));
|
||||
|
||||
UnInit();
|
||||
|
||||
m_frame = wnd;
|
||||
m_frame->PushEventHandler(this);
|
||||
|
||||
@@ -958,6 +961,7 @@ void wxAuiManager::UnInit()
|
||||
if (m_frame)
|
||||
{
|
||||
m_frame->RemoveEventHandler(this);
|
||||
m_frame = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3951,6 +3955,12 @@ void wxAuiManager::Repaint(wxDC* dc)
|
||||
delete client_dc;
|
||||
}
|
||||
|
||||
void wxAuiManager::OnDestroy(wxWindowDestroyEvent& event)
|
||||
{
|
||||
if ( event.GetEventObject() == m_frame )
|
||||
UnInit();
|
||||
}
|
||||
|
||||
void wxAuiManager::OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||
{
|
||||
wxPaintDC dc(m_frame);
|
||||
|
Reference in New Issue
Block a user