Clean up wxMSW tooltip window on library shutdown

Not doing this prevented the tooltips from working correctly if the library
was shut down and reinitialized again, so add a module ensuring this is done.

Closes #17360.
This commit is contained in:
Rebel_X
2016-02-13 12:55:17 +01:00
committed by Vadim Zeitlin
parent ccd361c98f
commit 35f35ea407
2 changed files with 39 additions and 0 deletions

View File

@@ -134,6 +134,30 @@ public:
}
};
// Takes care of deleting ToolTip control window when shutting down the library.
class wxToolTipModule : public wxModule
{
public:
wxToolTipModule()
{
}
virtual bool OnInit() wxOVERRIDE
{
return true;
}
virtual void OnExit() wxOVERRIDE
{
wxToolTip::DeleteToolTipCtrl();
}
private:
wxDECLARE_DYNAMIC_CLASS(wxToolTipModule);
};
wxIMPLEMENT_DYNAMIC_CLASS(wxToolTipModule, wxModule);
#ifdef __VISUALC__
#pragma warning( default : 4097 )
#endif
@@ -253,6 +277,15 @@ void wxToolTip::SetMaxWidth(int width)
ms_maxWidth = width;
}
void wxToolTip::DeleteToolTipCtrl()
{
if ( ms_hwndTT )
{
::DestroyWindow((HWND)ms_hwndTT);
ms_hwndTT = (WXHWND)NULL;
}
}
// ---------------------------------------------------------------------------
// implementation helpers
// ---------------------------------------------------------------------------