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

Alexander Strasser <[email protected]> Fri, 24 Mar 2023 21:38:22 +0100
Newsgroups gmane.comp.video.mplayer.devel
Message-ID <[email protected]>
Hi Brad,

On 2023-03-22 22:58 +0100, Reimar Döffinger wrote:
> > 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;
> > }
>
> Well, it's probably a good idea to do that, but a aoctl happening after uninit (if I understand right) is the far worse issue an probably needs to be fixed by itself.


Could you test if the attached patch also fixes the issues you observed?

Only lightly tested but it would help if you could confirm if it fixes
the problem.


Thanks,
  Alexander

_______________________________________________
MPlayer-dev-eng mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng
0001-mplayer-Do-not-un-initialize-components-before-exit_.patch (text/x-diff, 1.7 KB)
From 8af4f174548639e6e48265a1d84ec310a92359d2 Mon Sep 17 00:00:00 2001
From: Alexander Strasser <[email protected]>
Date: Fri, 24 Mar 2023 21:10:28 +0100
Subject: [PATCH] mplayer: Do not un-initialize components before
 exit_player_with_rc

After we finished all play tree items, we will call exit_player_with_rc.

When calling exit_player_with_rc, internally the routine will try
to uninit everything by itself.

More important: It will un-mute audio should it be muted, which would
end up in calling control on an uninitialized ao module in this case.
---
 mplayer.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/mplayer.c b/mplayer.c
index 7e86cb029..551072000 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -4122,9 +4122,6 @@ goto_next_file:  // don't jump here after ao/vo/getch initialization!
                    (total_time_usage > 0.5) ? (total_frame_cnt / total_time_usage) : 0);
     }

-    // time to uninit all, except global stuff:
-    uninit_player(INITIALIZED_ALL - (INITIALIZED_GUI + INITIALIZED_INPUT + (fixed_vo ? INITIALIZED_VO : 0)));
-
     if (mpctx->eof == PT_NEXT_ENTRY || mpctx->eof == PT_PREV_ENTRY) {
         mpctx->eof = mpctx->eof == PT_NEXT_ENTRY ? 1 : -1;
         if (play_tree_iter_step(mpctx->playtree_iter, mpctx->play_tree_step, 0) == PLAY_TREE_ITER_ENTRY) {
@@ -4178,6 +4175,10 @@ goto_next_file:  // don't jump here after ao/vo/getch initialization!
         if (!mpctx->playtree_iter && !use_gui)
             filename = NULL;
         mpctx->eof = 0;
+
+        // time to uninit all, except global stuff:
+        uninit_player(INITIALIZED_ALL - (INITIALIZED_GUI + INITIALIZED_INPUT + (fixed_vo ? INITIALIZED_VO : 0)));
+
         goto play_next_file;
     }

--