Remove mouse capture assert from wxGTK wxWindow dtor

This assert was redundant as a similar check is done in the base class dtor.
And while usually this assert is just annoying, instead of being helpful, when
running the unit test suite which installs a custom assert handler throwing an
exception, it is actively harmful as generating 2 asserts during the
destruction of a window with mouse capture results in immediate termination
(even in C++98 mode, unfortunately the whole idea of throwing from dtor is
probably unsalvageable anyhow when using C++11).
This commit is contained in:
Vadim Zeitlin
2016-06-29 17:55:17 +02:00
parent a7d82aa776
commit 8bb4495d95

View File

@@ -2604,15 +2604,12 @@ wxWindowGTK::~wxWindowGTK()
if ( gs_deferredFocusOut == this )
gs_deferredFocusOut = NULL;
// Unlike the above cases, which can happen in normal circumstances, a
// window shouldn't be destroyed while it still has capture, so even though
// we still reset the global pointer to avoid leaving it dangling and
// crashing afterwards, also complain about it.
// This is a real error, unlike the above, but it's already checked for in
// the base class dtor and asserting here results is useless and, even
// worse, results in abnormal termination when running unit tests which
// throw exceptions from their assert handler, so don't assert here.
if ( g_captureWindow == this )
{
wxFAIL_MSG( wxS("Destroying window with mouse capture") );
g_captureWindow = NULL;
}
if (m_wxwindow)
{