2) added wxCHECK( hWnd != NULL ) to wxAssociateWinWithHandle
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
// wxWnd
MSWDetachWindowMenu();
// wxWnd
MSWDetachWindowMenu();
- wxRemoveHandleAssociation(this);
-
// TODO for backward compatibility
#if 0
// WX_CANVAS
// TODO for backward compatibility
#if 0
// WX_CANVAS
if (m_hWnd)
::DestroyWindow((HWND)m_hWnd);
if (m_hWnd)
::DestroyWindow((HWND)m_hWnd);
+
+ wxRemoveHandleAssociation(this);
m_hWnd = 0;
#ifndef __WIN32__
if (m_globalHandle)
m_hWnd = 0;
#ifndef __WIN32__
if (m_globalHandle)
void wxWindow::SetDropTarget(wxDropTarget *pDropTarget)
{
void wxWindow::SetDropTarget(wxDropTarget *pDropTarget)
{
- DELETEP(m_pDropTarget);
+ if ( m_pDropTarget != 0 ) {
+ m_pDropTarget->Revoke(m_hWnd);
+ delete m_pDropTarget;
+ }
+
m_pDropTarget = pDropTarget;
if ( m_pDropTarget != 0 )
m_pDropTarget->Register(m_hWnd);
m_pDropTarget = pDropTarget;
if ( m_pDropTarget != 0 )
m_pDropTarget->Register(m_hWnd);
void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win)
{
void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win)
{
+ // adding NULL hWnd is (first) surely a result of an error and
+ // (secondly) breaks menu command processing
+ wxCHECK( hWnd != NULL );
+
if ( !wxWinHandleList->Find((long)hWnd) )
wxWinHandleList->Append((long)hWnd, win);
}
if ( !wxWinHandleList->Find((long)hWnd) )
wxWinHandleList->Append((long)hWnd, win);
}
#if DEBUG > 1
wxDebugMsg("wxWindow::MSWOnDestroy %d\n", handle);
#endif
#if DEBUG > 1
wxDebugMsg("wxWindow::MSWOnDestroy %d\n", handle);
#endif
- // delete our log target if we've got one
-#if USE_DRAG_AND_DROP
- if ( m_pDropTarget != 0 ) {
+ // delete our drop target if we've got one
+ #if USE_DRAG_AND_DROP
+ if ( m_pDropTarget != NULL ) {
m_pDropTarget->Revoke(m_hWnd);
delete m_pDropTarget;
m_pDropTarget = NULL;
}
m_pDropTarget->Revoke(m_hWnd);
delete m_pDropTarget;
m_pDropTarget = NULL;
}