X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1d6fcbcc7088e9c104b3dc5b4704a07f728d55ae..edba2de33ede5bbef0726e889d89fea2732d592d:/src/common/bookctrl.cpp diff --git a/src/common/bookctrl.cpp b/src/common/bookctrl.cpp index d194cc20a9..fef420180a 100644 --- a/src/common/bookctrl.cpp +++ b/src/common/bookctrl.cpp @@ -423,24 +423,25 @@ wxSize wxBookCtrlBase::GetControllerSize() const return size; } -int wxBookCtrlBase::DoSetSelection(size_t n, int flags, wxBookCtrlBaseEvent &event) +int wxBookCtrlBase::DoSetSelection(size_t n, int flags) { wxCHECK_MSG( n < GetPageCount(), wxNOT_FOUND, wxT("invalid page index in wxBookCtrlBase::DoSetSelection()") ); const int oldSel = GetSelection(); - if ( oldSel != wxNOT_FOUND && n != (size_t)oldSel ) + if ( n != (size_t)oldSel ) { + wxBookCtrlBaseEvent *event = CreatePageChangingEvent(); bool allowed = false; if ( flags & SetSelection_SendEvent ) { - event.SetSelection(n); - event.SetOldSelection(oldSel); - event.SetEventObject(this); + event->SetSelection(n); + event->SetOldSelection(oldSel); + event->SetEventObject(this); - allowed = !GetEventHandler()->ProcessEvent(event) || event.IsAllowed(); + allowed = !GetEventHandler()->ProcessEvent(*event) || event->IsAllowed(); } if ( !(flags & SetSelection_SendEvent) || allowed) @@ -458,10 +459,12 @@ int wxBookCtrlBase::DoSetSelection(size_t n, int flags, wxBookCtrlBaseEvent &eve if ( flags & SetSelection_SendEvent ) { // program allows the page change - MakeChangedEvent(event); - (void)GetEventHandler()->ProcessEvent(event); + MakeChangedEvent(*event); + (void)GetEventHandler()->ProcessEvent(*event); } } + + delete event; } return oldSel;