svn commit: r346631 - head/lib/libvgl

Bruce Evans bde at FreeBSD.org
Wed Apr 24 13:15:57 UTC 2019


Author: bde
Date: Wed Apr 24 13:15:56 2019
New Revision: 346631
URL: https://svnweb.freebsd.org/changeset/base/346631

Log:
  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).

Modified:
  head/lib/libvgl/main.c

Modified: head/lib/libvgl/main.c
==============================================================================
--- head/lib/libvgl/main.c	Wed Apr 24 09:05:45 2019	(r346630)
+++ head/lib/libvgl/main.c	Wed Apr 24 13:15:56 2019	(r346631)
@@ -73,11 +73,11 @@ struct vt_mode smode;
 
   if (!VGLInitDone)
     return;
-  VGLInitDone = 0;
+  signal(SIGUSR1, SIG_IGN);
+  signal(SIGUSR2, SIG_IGN);
   VGLSwitchPending = 0;
   VGLAbortPending = 0;
-
-  signal(SIGUSR1, SIG_IGN);
+  VGLMousePointerHide();
 
   if (VGLMem != MAP_FAILED) {
     VGLClear(VGLDisplay, 0);


More information about the svn-src-head mailing list