diff --git a/src/aui/auibook.cpp b/src/aui/auibook.cpp index 00d1d073ff..032e467b80 100644 --- a/src/aui/auibook.cpp +++ b/src/aui/auibook.cpp @@ -3694,6 +3694,13 @@ void wxAuiNotebook::OnTabButton(wxCommandEvent& command_evt) { int selection = evt.GetSelection(); + if (selection == -1) + { + // if the close button is to the right, use the active + // page selection to determine which page to close + selection = GetSelection(); + } + if (selection != -1) { wxWindow* close_wnd = tabs->GetWindowFromIdx(selection);