Destroy correct HWND in wxMSW wxSpinCtrl::Reparent().

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
This commit is contained in:
Vadim Zeitlin 2010-10-31 11:37:26 +00:00
parent 053e42428d
commit bc73fe96a2

View File

@ -604,9 +604,11 @@ bool wxSpinCtrl::Reparent(wxWindowBase *newParent)
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"));
}