Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes for Find next and Find previous
• Use wxSharedPtr instead of wxWeakRef for the m_findWindow member variable. The following is from the *wxWeakRef< T > Class Template Reference* page of the wxWidgets documentation found at http://docs.wxwidgets.org/trunk/classwx_weak_ref_3_01_t_01_4.html. """ wxWeakRef<T> is a template class for weak references to wxWidgets objects, such as wxEvtHandler, wxWindow and wxObject. A weak reference behaves much like an ordinary pointer, but when the object pointed is destroyed, the weak reference is automatically reset to a NULL pointer. """ What this says is that the moment the Find Frame is destroyed, the weak reference is set to null as well. This is not what we want. This in fact prevents the PoeditFrame::OnFindNext and PoeditFrame::OnFindPrev functions from working properly. The PoeditFrame::OnFind and PoeditFrame::OnFindAndReplace both initialize the m_findWindow if necessary. Then they use the m_findWindow member variable to display the frame by calling either FindFrame::ShowForFind or FindFrame::ShowForReplace. When the PoeditFrame::OnFindNext or PoeditFrame::OnFindPrev functions are called in response to the Find next and Find previous menu items these functions expect the m_findWindow member variable to be non null. However, due to the fact that as a side effect of it being a wxWeakRef the pointer was reset to null the moment the frame was closed by the wxAppConsoleBase::DeletePendingObjects function, this is not the case. Thus the PoeditFrame::OnFindNext and PoeditFrame::OnFindPrev functions do nothing. • Added missing wxAcceleratorEntry entries for menu_find_next and menu_find_prev. • Modified the FindFrame::OnClose function to call Show(false) instead of calling Destroy().
- Loading branch information