From 884a369a7333e552e247940faf49a9f448b8f6c4 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Mon, 23 Jul 2007 12:23:28 +0000 Subject: [PATCH] Avoid a hang if we're dragging a tab to a notebook that's a child of the original tab git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47663 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/aui/auibook.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/aui/auibook.cpp b/src/aui/auibook.cpp index 032e467b80..1edd86ee91 100644 --- a/src/aui/auibook.cpp +++ b/src/aui/auibook.cpp @@ -3414,6 +3414,17 @@ void wxAuiNotebook::OnTabEndDrag(wxCommandEvent& command_evt) int src_idx = evt.GetSelection(); wxWindow* src_page = src_tabs->GetWindowFromIdx(src_idx); + // Check that it's not an impossible parent relationship + wxWindow* p = nb; + while (p && !p->IsTopLevel()) + { + if (p == src_page) + { + return; + } + p = p->GetParent(); + } + // get main index of the page int main_idx = m_tabs.GetIdxFromWindow(src_page); wxCHECK_RET( main_idx != wxNOT_FOUND, _T("no source page?") ); @@ -3700,7 +3711,7 @@ void wxAuiNotebook::OnTabButton(wxCommandEvent& command_evt) // page selection to determine which page to close selection = GetSelection(); } - + if (selection != -1) { wxWindow* close_wnd = tabs->GetWindowFromIdx(selection); -- 2.45.2