Avoid bogus assert failures when releasing mouse capture
Calling ReleaseMouse() from wxEVT_MOUSE_CAPTURE_LOST handler could
result in bogus asserts about ReleaseMouse() reentrancy because the
function generating "capture lost" events in wx itself wrongly set the
wxMouseCapture::changing flag, instead of just examining it, as it was
supposed to do.
This corrects a problem introduced back in b0ad1918b9
(No changes, just
use wxRecursionGuard instead of manual boolean flag., 2013-08-18) which,
contrary to the commit message, did change the behaviour by replacing a
simple test with the use of wxRecursionGuard here.
This commit is contained in:
@@ -3426,9 +3426,11 @@ static void DoNotifyWindowAboutCaptureLost(wxWindow *win)
|
||||
void wxWindowBase::NotifyCaptureLost()
|
||||
{
|
||||
// don't do anything if capture lost was expected, i.e. resulted from
|
||||
// a wx call to ReleaseMouse or CaptureMouse:
|
||||
wxRecursionGuard guard(wxMouseCapture::changing);
|
||||
if ( guard.IsInside() )
|
||||
// a wx call to ReleaseMouse or CaptureMouse (but note that we must not
|
||||
// change the "changing" flag here as the user code is expected to call
|
||||
// ReleaseMouse() from its wxMouseCaptureLostEvent handler and this
|
||||
// shouldn't assert because the capture is already "changing")
|
||||
if ( wxMouseCapture::changing )
|
||||
return;
|
||||
|
||||
// if the capture was lost unexpectedly, notify every window that has
|
||||
|
Reference in New Issue
Block a user