]> git.saurik.com Git - wxWidgets.git/commitdiff
Add a hack to prevent the test suite from aborting after Grid test case.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 29 Apr 2012 23:22:10 +0000 (23:22 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 29 Apr 2012 23:22:10 +0000 (23:22 +0000)
There is a problem with the native header control still having the mouse
capture when the grid is destroyed in wxGTK and this resulted in asserts when
destroying the grid, nested asserts due to an exception being thrown from a
dtor and finally abort that prevented the rest of the tests from running.

As I failed to find the real reason for this problem, just forcefully ensure
that we don't have the mouse capture when destroying the grid. This at least
allows the complete test suite to run.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71319 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

tests/controls/gridtest.cpp

index a871ad9e7a774cc464e556682f3c706d2f6ba7fa..aea226aa2b2dac6f6147c46e240220c6fb1d5542 100644 (file)
@@ -120,6 +120,18 @@ void GridTestCase::setUp()
 
 void GridTestCase::tearDown()
 {
+    // This is just a hack to continue the rest of the tests to run: if we
+    // destroy the header control while it has capture, this results in an
+    // assert failure and while handling an exception from it more bad things
+    // happen (as it's thrown from a dtor), resulting in simply aborting
+    // everything. So ensure that it doesn't have capture in any case.
+    //
+    // Of course, the right thing to do would be to understand why does it
+    // still have capture when the grid is destroyed sometimes.
+    wxWindow* const win = wxWindow::GetCapture();
+    if ( win )
+        win->ReleaseMouse();
+
     wxDELETE(m_grid);
 }