]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix some races and screeen clearing in VGLEnd().
authorbde <bde@FreeBSD.org>
Wed, 24 Apr 2019 13:15:56 +0000 (13:15 +0000)
committerbde <bde@FreeBSD.org>
Wed, 24 Apr 2019 13:15:56 +0000 (13:15 +0000)
commit926b764545472238b5ae634d9090d6c96bb8a958
tree091d554475e9e53b1ed8580ef94e3eed0caf417b
parent97ddb4fef9603a0799d6c2981d8a1ccaf8a6db18
Fix some races and screeen clearing in VGLEnd().

The mouse signal SIGUSR2 was not turned off for normal termination and
in some other cases.  Thus mouse signals arriving after the frame
buffer was unmapped always caused fatal traps.  The fatal traps occurred
about 1 time in 5 if the mouse was wiggled while vgl is ending.

The screen switch signal SIGUSR1 was turned off after clearing the
flag that it sets.  Unlike the mouse signal, this signal is handled
synchronously, but VGLEnd() does screen clearing which does the
synchronous handling.  This race is harder to lose.  I think it can
get vgl into deadlocked state (waiting in the screen switch handler
with SIGUSR1 to leave that state already turned off).

Turn off the mouse cursor before clearing the screen in VGLEnd().
Otherwise, clearing is careful to not clear the mouse cursor.  Undrawing
an active mouse cursor uses a lot of state, so is dangerous for abnormal
termination, but so is clearing.  Clearing is slow and is usually not
needed, since the kernel also does it (not quite right).
lib/libvgl/main.c