[PATCH] Fix a sndio crash when exiting in muted state

Brad Smith <[email protected]> Tue, 14 Mar 2023 06:31:19 -0400
Newsgroups gmane.comp.video.mplayer.devel
Message-ID <[email protected]>
Patch from Theo Buehler <[email protected]>

CVSROOT:	/cvs
Module name:	ports
Changes by:	[email protected]	2023/03/14 04:08:13

Modified files:
	x11/mplayer    : Makefile 
	x11/mplayer/patches: patch-libao2_ao_sndio_c 

Log message:
mplayer: fix a crash when exiting in muted state

Muting mplayer with 'm', then hitting '<enter>' segfaults mplayer since it
tries to unmute itself after uninitializing the sndio backend. Clear the
havevol flag on uninit() to block subsequent AOCONTROL_{GET,SET}_VOLUME
operations.

Fix suggested by and ok ratchov


Index: libao2/ao_sndio.c
===================================================================
--- libao2/ao_sndio.c	(revision 38412)
+++ libao2/ao_sndio.c	(working copy)
@@ -159,6 +159,7 @@
     pfds = NULL;
     sio_close(hdl);
     hdl = NULL;
+    havevol = 0;
     return 0;
 }
 
@@ -172,6 +173,7 @@
     hdl = NULL;
     free(pfds);
     pfds = NULL;
+    havevol = 0;
 }
 
 /*