NULL HWND was passed to ::DestroyWindow() as wxWindow::UnsubclassWin() NULLed
it after unsubclassing.
See #12633.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65965
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
int value = GetValue();
const wxRect btnRect = wxRectFromRECT(wxGetWindowRect(GetHwnd()));
- // destroy the old spin button
+ // destroy the old spin button after detaching it from this wxWindow object
+ // (notice that m_hWnd will be reset by UnsubclassWin() so save it first)
+ const HWND hwndOld = GetHwnd();
UnsubclassWin();
- if ( !::DestroyWindow(GetHwnd()) )
+ if ( !::DestroyWindow(hwndOld) )
{
wxLogLastError(wxT("DestroyWindow"));
}