From: Colin Guthrie <gmane@colin.guthr.ie>
To: alsa-devel@alsa-project.org
Subject: Re: [PATCH 1/4] pulse: get rid of a number of assert()s
Date: Fri, 31 Jul 2009 15:48:32 +0100 [thread overview]
Message-ID: <h4v080$v96$1@ger.gmane.org> (raw)
In-Reply-To: <20090731140133.GA31121@omega>
'Twas brillig, and Lennart Poettering at 31/07/09 15:01 did gyre and gimble:
> Instead of hitting an assert when any of the plugin functions is called
> in an invalid context we should return a clean error to make sure
> programs are not unnecessarily aborted.
>
> This should fix issues such as http://pulseaudio.org/ticket/595
> ---
> pulse/ctl_pulse.c | 35 +++++++++++++++++------
> pulse/pcm_pulse.c | 79 +++++++++++++++++++++++++++++++++++++++++------------
> pulse/pulse.c | 34 ++++++++++++++++-------
> 3 files changed, 111 insertions(+), 37 deletions(-)
>
> diff --git a/pulse/ctl_pulse.c b/pulse/ctl_pulse.c
> index c6cf9e2..1b057ef 100644
> --- a/pulse/ctl_pulse.c
> +++ b/pulse/ctl_pulse.c
> @@ -525,8 +542,8 @@ static int pulse_ctl_poll_revents(snd_ctl_ext_t * ext, struct pollfd *pfd,
> snd_ctl_pulse_t *ctl = ext->private_data;
> int err = 0;
>
> - assert(ctl);
> - assert(ctl->p);
> + if (!ctl->p || !ctl->p->mainloop || !ctl->p->context)
> + return -EBADFD;
>
> pa_threaded_mainloop_lock(ctl->p->mainloop);
>
Just a smidge overzealous in this one (only one I spotted).
Couldn't find these commits in your alsa-plugins clone at
git://git.0pointer.de/alsa-plugins.git so couldn't create a followup
patch so here it is inline (against 1.2.20 so line numbers may be off):
--- alsa-plugins-1.0.20/pulse/ctl_pulse.c~ 2009-07-31 15:39:22.000000000
+0100
+++ alsa-plugins-1.0.20/pulse/ctl_pulse.c 2009-07-31 15:47:32.000000000
+0100
@@ -542,6 +542,8 @@
snd_ctl_pulse_t *ctl = ext->private_data;
int err = 0;
+ assert(ctl);
+
if (!ctl->p || !ctl->p->mainloop || !ctl->p->context)
return -EBADFD;
Col.
--
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/
Day Job:
Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
Mandriva Linux Contributor [http://www.mandriva.com/]
PulseAudio Hacker [http://www.pulseaudio.org/]
Trac Hacker [http://trac.edgewall.org/]
next prev parent reply other threads:[~2009-07-31 14:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-31 14:01 [PATCH 1/4] pulse: get rid of a number of assert()s Lennart Poettering
2009-07-31 14:48 ` Colin Guthrie [this message]
2009-07-31 15:10 ` Lennart Poettering
2009-07-31 15:15 ` Lennart Poettering
2009-08-03 10:40 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='h4v080$v96$1@ger.gmane.org' \
--to=gmane@colin.guthr.ie \
--cc=alsa-devel@alsa-project.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox