diff --git a/wx/lib/agw/aui/auibook.py b/wx/lib/agw/aui/auibook.py index 8cb6756f..7277d010 100644 --- a/wx/lib/agw/aui/auibook.py +++ b/wx/lib/agw/aui/auibook.py @@ -2019,15 +2019,15 @@ class AuiTabCtrl(wx.Control, AuiTabContainer): if self._is_dragging: - if self.HasCapture(): - self.ReleaseMouse() - self._is_dragging = False if self._drag_image: self._drag_image.EndDrag() del self._drag_image self._drag_image = None self.GetParent().Refresh() + + if self.HasCapture(): + self.ReleaseMouse() evt = AuiNotebookEvent(wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, self.GetId()) evt.SetSelection(self.GetIdxFromWindow(self._click_tab))